Files
git-mirror/V
Junio C Hamano 87abcd426a V: use the describe --long format
This will hopefully help catching a mistake to tag different commits
with the same tag again.
2023-11-23 13:28:43 +09:00

73 lines
1.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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="" out=""
installed=" none"
else
installed=$(git describe --long $version)
case "$dirty" in
'')
;;
?*)
installed="$installed$dirty"
esac
in="" out="" 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/ .*//'