]> git.ipfire.org Git - thirdparty/gcc.git/blame - contrib/git-descr.sh
asan: Don't instrument .ABNORMAL_DISPATCHER [PR114743]
[thirdparty/gcc.git] / contrib / git-descr.sh
CommitLineData
9cbfbe24
ML
1#!/bin/sh
2
3# Script to describe a GCC revision based on git hash
4
5short=no
6long=no
88b9d090 7c=HEAD
9cbfbe24
ML
8
9for arg in "$@"
10do
11 case "$arg" in
12 --short) short=yes long=no
13 ;;
14 --long|--full) long=yes short=no
15 ;;
16 *) c=$arg
17 esac
18done
19
20if test x$short = xyes; then
ff060ef0 21 r=$(git describe --all --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-\([0-9][0-9]*\)-\([0-9][0-9]*\)-g[0-9a-f]*$,r\1-\2,p;s,^basepoints/gcc-\([0-9][0-9]*\)$,r\1-0,p');
9cbfbe24 22elif test x$long = xyes; then
ff060ef0 23 r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
9cbfbe24 24else
ff060ef0 25 r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
10ecf518 26 expr ${r:-no} : 'r[0-9]\+$' >/dev/null && r=${r}-0-g$(git rev-parse $c);
9cbfbe24
ML
27fi;
28if test -n $r; then
29 o=$(git config --get gcc-config.upstream);
30 rr=$(echo $r | sed -n 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p');
31 if git rev-parse --verify --quiet ${o:-origin}/releases/gcc-$rr >/dev/null; then
32 m=releases/gcc-$rr;
33 else
34 m=master;
35 fi;
36 git merge-base --is-ancestor $c ${o:-origin}/$m && echo ${r};
37fi;