github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/.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