5
Rev | Line | |
---|
[6f3fb8a] | 1 | #! /bin/sh |
---|
| 2 | |
---|
| 3 | git=$(command -v git) |
---|
| 4 | |
---|
| 5 | # |
---|
| 6 | # Git command not found or not a valid git repo is a release. |
---|
| 7 | # |
---|
| 8 | vc_ident="release" |
---|
| 9 | |
---|
| 10 | if test $# -ge 1; then |
---|
| 11 | repo=$1 |
---|
| 12 | shift |
---|
| 13 | if test -d $repo; then |
---|
| 14 | cwd=$(pwd) |
---|
| 15 | cd $repo |
---|
| 16 | if test -n ${git}; then |
---|
| 17 | git rev-parse --git-dir > /dev/null 2>&1 |
---|
[f5b3c024] | 18 | if test $? = 0; then |
---|
[6f3fb8a] | 19 | git status > /dev/null 2>&1 |
---|
| 20 | if git diff-index --quiet HEAD --; then |
---|
| 21 | modified="" |
---|
| 22 | else |
---|
| 23 | modified="-modified" |
---|
| 24 | fi |
---|
| 25 | vc_ident="$(git rev-parse --verify HEAD)${modified}" |
---|
| 26 | if test $# -ge 1; then |
---|
[f5b3c024] | 27 | if test "${vc_ident}" = "$1"; then |
---|
[6f3fb8a] | 28 | vc_ident="matches" |
---|
| 29 | fi |
---|
| 30 | fi |
---|
| 31 | fi |
---|
| 32 | fi |
---|
| 33 | cd $cwd |
---|
| 34 | fi |
---|
| 35 | fi |
---|
| 36 | |
---|
| 37 | echo ${vc_ident} |
---|
| 38 | |
---|
| 39 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.