github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/.githooks/pre-commit (about)

     1  #!/bin/sh
     2  
     3  STATUS=0
     4  
     5  if git rev-parse --verify HEAD >/dev/null 2>&1; then
     6      against=HEAD
     7  else
     8      against=$(git hash-object -t tree /dev/null)
     9  fi
    10  
    11  for f in $(git diff --relative --cached --name-only $against | grep '\.\(go\|sh\)$'); do
    12      if ! test "head -n4 '$f' | grep -q 'Copyright (c) IBM Corp\.'"; then
    13          echo "Missing copyright header in $f"
    14          STATUS=1
    15      fi
    16  done
    17  
    18  exit $STATUS