-
Notifications
You must be signed in to change notification settings - Fork 0
/
V
executable file
·60 lines (57 loc) · 1.18 KB
/
V
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
inst_prefix=$(
IFS=:
for p in $PATH
do
probed=${p%/git-active/bin}
if test "$probed" != "$p"
then
echo "$probed"
exit
fi
done
echo $HOME
)
for v in maint master next pu jch
do
installed=$(
test -f "$inst_prefix/git-$v/bin/git" &&
"$inst_prefix/git-$v/bin/git" version
)
dirty=
if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
then
:
elif version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)\.dirty$')
then
dirty=" (with changes)"
elif version=v$(expr "$installed" : \
'git version \(.*\)\.rc[0-9]*$')
then
version="$version"-$(expr "$installed" : \
'git version .*\.\(rc[0-9]*\)$')
else
version=v$(expr "$installed" : 'git version \(.*\)')
fi
version=$(git rev-parse --verify "$version^0" 2>/dev/null)
revision=$(git show-ref -s --verify "refs/heads/$v")
if test "z$version" = "z$revision"
then
in= out=
installed=$dirty
elif test -z "$version"
then
in="[41;37m" out="[m"
installed=" none"
else
installed=$(git describe $version)
case "$dirty" in
'')
;;
?*)
installed="$installed$dirty"
esac
in="[41;37m" out="[m" installed=" $installed"
fi
echo "$in$v$out $(git describe refs/heads/$v)$installed"
done