What's cooking (2024/05 #04)
[alt-git.git] / V
blob8dee018a2348e29ca3c53538aa4a9059c03f44a0
1 #!/bin/sh
3 inst_prefix=$(
4 IFS=:
5 for p in $PATH
6 do
7 probed=${p%/git-active/bin}
8 if test "$probed" != "$p"
9 then
10 echo "$probed"
11 exit
13 done
14 echo $HOME
17 LF='
19 output=
20 for v in maint master next jch seen
22 installed=$(
23 test -f "$inst_prefix/git-$v/bin/git" &&
24 "$inst_prefix/git-$v/bin/git" version
26 dirty=
27 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
28 then
30 elif version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)\.dirty$')
31 then
32 dirty=" (with changes)"
33 elif version=v$(expr "$installed" : \
34 'git version \(.*\)\.rc[0-9]*$')
35 then
36 version="$version"-$(expr "$installed" : \
37 'git version .*\.\(rc[0-9]*\)$')
38 else
39 version=v$(expr "$installed" : 'git version \(.*\)')
42 version=$(git rev-parse --verify "$version^0" 2>/dev/null)
43 revision=$(git show-ref -s --verify "refs/heads/$v")
44 if test "z$version" = "z$revision"
45 then
46 in= out=
47 if test -z "$dirty"
48 then
49 installed=
50 else
51 installed=" $installed$dirty"
53 elif test -z "$version"
54 then
55 in="\e[41;37m" out="\e[m"
56 installed=" none"
57 else
58 installed=$(git describe --long $version)
59 case "$dirty" in
60 '')
62 ?*)
63 installed="$installed$dirty"
64 esac
65 in="\e[41;37m" out="\e[m" installed=" $installed"
67 output="$output${output:+$LF}"
68 output="$output$in$v$out$installed $(git describe --long refs/heads/$v)"
69 done
71 echo "$output"
72 echo "$output" | sha1sum | sed -e 's/ .*//'