github.com/XiaoMi/Gaea@v1.2.5/misc/git/pre-commit (about)

     1  #!/bin/bash
     2  
     3  # Runs any hooks in misc/git/hooks, and exits if any of them fail.
     4  set -e
     5  
     6  # This is necessary because the Emacs extensions don't set GIT_DIR.
     7  if [ -z "$GIT_DIR" ]; then
     8    DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
     9    GIT_DIR="${DIR}/.."
    10  fi
    11  
    12  # This is necessary because the Atom packages don't set GOPATH
    13  if [ -z "$GOPATH" ]; then
    14    GOPATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../../../../.." && pwd )
    15    export GOPATH
    16  fi
    17  
    18  for hook in $GIT_DIR/../misc/git/hooks/*; do
    19    $hook
    20  done