github.com/trevoraustin/hub@v2.2.0-preview1.0.20141105230840-96d8bfc654cc+incompatible/git-hooks/changed-version.sh (about)

     1  #!/bin/bash
     2  ## If version file is staged to be committed, display the new version number.
     3  
     4  version_file="${1:-lib/hub/version.rb}"
     5  
     6  if git rev-parse --verify HEAD >/dev/null 2>&1; then
     7    if git diff-index --quiet --cached HEAD -- "$version_file"; then
     8      exit 1
     9    else
    10      git cat-file blob ":$version_file" | grep VERSION | head -1 | cut -d\' -f2
    11    fi
    12  else
    13    exit 1
    14  fi