gcc/contrib/git-undescr.sh
Martin Liska bb6a8d1d52 git-undescr.sh: Support full output of git-descr.sh.
contrib/ChangeLog:

	* git-undescr.sh: Support full output of git-descr.sh.
2022-01-27 19:35:16 +01:00

14 lines
639 B
Bash
Executable File

#!/bin/sh
# Script to undescribe a GCC revision
o=$(git config --get gcc-config.upstream);
r=$(echo $1 | sed -n 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p');
n=$(echo $1 | sed -n 's,^r[0-9]\+-\([0-9]\+\)\(-g[0-9a-f]\+\)\?$,\1,p');
test -z $r && echo Invalid id $1 && exit 1;
h=$(git rev-parse --verify --quiet ${o:-origin}/releases/gcc-$r);
test -z $h && h=$(git rev-parse --verify --quiet ${o:-origin}/master);
p=$(git describe --all --match 'basepoints/gcc-'$r $h | sed -n 's,^\(tags/\)\?basepoints/gcc-[0-9]\+-\([0-9]\+\)-g[0-9a-f]*$,\2,p;s,^\(tags/\)\?basepoints/gcc-[0-9]\+$,0,p');
git rev-parse --verify $h~$(expr $p - $n);