blob: 8dee018a2348e29ca3c53538aa4a9059c03f44a0 (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/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
)
LF='
'
output=
for v in maint master next jch seen
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=
if test -z "$dirty"
then
installed=
else
installed=" $installed$dirty"
fi
elif test -z "$version"
then
in="[41;37m" out="[m"
installed=" none"
else
installed=$(git describe --long $version)
case "$dirty" in
'')
;;
?*)
installed="$installed$dirty"
esac
in="[41;37m" out="[m" installed=" $installed"
fi
output="$output${output:+$LF}"
output="$output$in$v$out$installed $(git describe --long refs/heads/$v)"
done
echo "$output"
echo "$output" | sha1sum | sed -e 's/ .*//'
|