Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:27

0001 #! /bin/sh
0002 
0003 git=$(command -v git)
0004 
0005 #
0006 # Git command not found or not a valid git repo is a release.
0007 #
0008 vc_ident="release"
0009 
0010 if test $# -ge 1; then
0011  repo=$1
0012  shift
0013  if test -d $repo; then
0014   cwd=$(pwd)
0015   cd $repo
0016   if test -n ${git}; then
0017    git rev-parse --git-dir > /dev/null 2>&1
0018    if test $? = 0; then
0019     git status > /dev/null 2>&1
0020     if git diff-index --quiet HEAD --; then
0021      modified=""
0022     else
0023      modified="-modified"
0024     fi
0025     vc_ident="$(git rev-parse --verify HEAD)${modified}"
0026     if test $# -ge 1; then
0027      if test "${vc_ident}" = "$1"; then
0028       vc_ident="matches"
0029      fi
0030     fi
0031    fi
0032   fi
0033   cd $cwd
0034  fi
0035 fi
0036 
0037 echo ${vc_ident}
0038 
0039 exit 0