mirror of
https://github.com/git/git
synced 2024-10-01 22:25:58 +00:00
38 lines
906 B
Bash
Executable file
38 lines
906 B
Bash
Executable file
#!/bin/sh
|
||
|
||
for v in maint master next pu jch
|
||
do
|
||
installed=$($HOME/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=t
|
||
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:+" (with changes)"}
|
||
else
|
||
installed=$(git describe $version)
|
||
case "$dirty" in
|
||
t)
|
||
installed="$installed.dirty"
|
||
esac
|
||
in="[41;37m" out="[m" installed=" $installed"
|
||
fi
|
||
echo "$in$v$out $(git describe refs/heads/$v)$installed"
|
||
done
|