newvers.sh: add support for gitup(1)
gitup writes a .gituprevision file into the shallow clone directory. Read that file and print commit information only. Submitted by: Michael Osipov <michael.osipov@siemens.com> Pull Request: https://github.com/freebsd/freebsd-src/pull/449 While here, drop the redundant branch name from the git output and don't count commits in shallow clones. Reported by: Michael Osipov <michael.osipov@siemens.com> MFC after: 2 weeks
This commit is contained in:
parent
a0e85d0eb5
commit
a9fc14fbf4
@ -221,6 +221,10 @@ if findvcs .git; then
|
||||
done
|
||||
fi
|
||||
|
||||
if findvcs .gituprevision; then
|
||||
gituprevision="${VCSTOP}/.gituprevision"
|
||||
fi
|
||||
|
||||
if findvcs .hg; then
|
||||
for dir in /usr/bin /usr/local/bin; do
|
||||
if [ -x "${dir}/hg" ] ; then
|
||||
@ -248,13 +252,11 @@ fi
|
||||
|
||||
if [ -n "$git_cmd" ] ; then
|
||||
git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null)
|
||||
git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
|
||||
if [ -n "$git_cnt" ] ; then
|
||||
git="c${git_cnt}-g${git}"
|
||||
fi
|
||||
git_b=$($git_cmd rev-parse --abbrev-ref HEAD)
|
||||
if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then
|
||||
git="${git_b}-${git}"
|
||||
if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then
|
||||
git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
|
||||
if [ -n "$git_cnt" ] ; then
|
||||
git="c${git_cnt}-g${git}"
|
||||
fi
|
||||
fi
|
||||
if git_tree_modified; then
|
||||
git="${git}-dirty"
|
||||
@ -263,6 +265,10 @@ if [ -n "$git_cmd" ] ; then
|
||||
git=" ${git}"
|
||||
fi
|
||||
|
||||
if [ -n "$gituprevision" ] ; then
|
||||
gitup=" $(awk -F: '{print $2}' $gituprevision)"
|
||||
fi
|
||||
|
||||
if [ -n "$hg_cmd" ] ; then
|
||||
hg=$($hg_cmd id 2>/dev/null)
|
||||
hgsvn=$($hg_cmd svn info 2>/dev/null | \
|
||||
@ -277,10 +283,10 @@ fi
|
||||
|
||||
[ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes
|
||||
if [ ${include_metadata} != "yes" ]; then
|
||||
VERINFO="${VERSION}${svn}${git}${hg} ${i}"
|
||||
VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}"
|
||||
VERSTR="${VERINFO}\\n"
|
||||
else
|
||||
VERINFO="${VERSION} #${v}${svn}${git}${hg}: ${t}"
|
||||
VERINFO="${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}"
|
||||
VERSTR="${VERINFO}\\n ${u}@${h}:${d}\\n"
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user