Meta/Reintegrate: redo the rerere part
[git/jnareb-git.git] / V
blobcd67951db8fa9dd05e0da1f9aa3e9fe238509af1
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 for v in maint master next pu jch
19 installed=$(
20 test -f "$inst_prefix/git-$v/bin/git" &&
21 "$inst_prefix/git-$v/bin/git" version
23 dirty=
24 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
25 then
27 elif version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)\.dirty$')
28 then
29 dirty=" (with changes)"
30 elif version=v$(expr "$installed" : \
31 'git version \(.*\)\.rc[0-9]*$')
32 then
33 version="$version"-$(expr "$installed" : \
34 'git version .*\.\(rc[0-9]*\)$')
35 else
36 version=v$(expr "$installed" : 'git version \(.*\)')
39 version=$(git rev-parse --verify "$version^0" 2>/dev/null)
40 revision=$(git show-ref -s --verify "refs/heads/$v")
41 if test "z$version" = "z$revision"
42 then
43 in= out=
44 installed=$dirty
45 elif test -z "$version"
46 then
47 in="\e[41;37m" out="\e[m"
48 installed=" none"
49 else
50 installed=$(git describe $version)
51 case "$dirty" in
52 '')
54 ?*)
55 installed="$installed$dirty"
56 esac
57 in="\e[41;37m" out="\e[m" installed=" $installed"
59 echo "$in$v$out $(git describe refs/heads/$v)$installed"
60 done