Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. raphael-brand revised this gist Apr 7, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-hook-add-copyright-to-modified-file.sh
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,6 @@ CPRGHT_NOTICE='/* Copyright (c) 2023 Raphael Brand
    for file in $(git status --porcelain | grep -E '^(M|A)' | awk '{print $2}')
    do
    if ! (( $(grep -ir 'Copyright' $file | wc -l) >= 1 )); then
    echo $CPRGHT_NOTICE | sed 's/\\//g'| echo "$CPRGHT_NOTICE$(cat $file)" > temp && mv temp $file
    echo "$CPRGHT_NOTICE$(cat $file)" > temp && mv temp $file
    fi
    done
  2. raphael-brand created this gist Apr 6, 2023.
    13 changes: 13 additions & 0 deletions git-hook-add-copyright-to-modified-file.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/bin/sh


    CPRGHT_NOTICE='/* Copyright (c) 2023 Raphael Brand
    License MIT
    */
    '
    for file in $(git status --porcelain | grep -E '^(M|A)' | awk '{print $2}')
    do
    if ! (( $(grep -ir 'Copyright' $file | wc -l) >= 1 )); then
    echo $CPRGHT_NOTICE | sed 's/\\//g'| echo "$CPRGHT_NOTICE$(cat $file)" > temp && mv temp $file
    fi
    done