From: Jakub Jelinek Date: Mon, 13 Jan 2020 14:15:17 +0000 (+0100) Subject: contrib: Add git gcc-descr and gcc-undescr aliases. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e19db6a2f7aa20b708ffa112767efbd378c94416;p=gcc.git contrib: Add git gcc-descr and gcc-undescr aliases. 2020-01-13 Jakub Jelinek * contrib/gcc-git-customization.sh: Add git gcc-descr and gcc-undescr aliases. --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index ddaff4fc6d8..dd0c4c4d8dd 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2020-01-13 Jakub Jelinek + + * contrib/gcc-git-customization.sh: Add git gcc-descr and gcc-undescr + aliases. + 2010-01-13 Richard Earnshaw * gcc-git-customization.sh: New file. diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh index 169c3a4d356..3b9d79d3d38 100755 --- a/contrib/gcc-git-customization.sh +++ b/contrib/gcc-git-customization.sh @@ -20,6 +20,11 @@ ask () { # Add a git command to find the git commit equivalent to legacy SVN revision NNN git config alias.svn-rev '!f() { rev=$1; shift; git log --all --grep="From-SVN: r\\?$rev\\b" "${@}"; } ; f' +# Add git commands to convert git commit to monotonically increasing revision number +# and vice versa +git config alias.gcc-descr \!"f() { if test \${1:-no} = --full; then r=\$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' \${2:-master} | sed -n 's,^tags/basepoints/gcc-,r,p'); expr match \${r:-no} '^r[0-9]\\+\$' >/dev/null && r=\${r}-0-g\$(git rev-parse \${2:-master}); test -n \$r && echo \${r}; else git describe --all --match 'basepoints/gcc-[0-9]*' \${1:-master} | sed -n 's,^tags/basepoints/gcc-\\([0-9]\\+\\)-\\([0-9]\\+\\)-g[0-9a-f]*\$,r\\1-\\2,p;s,^tags/basepoints/gcc-\\([0-9]\\+\\)\$,r\\1-0,p'; fi; }; f" +git config alias.gcc-undescr \!"f() { o=\$(git config --get gcc-config.upstream); r=\$(echo \$1 | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\$,\\1,p'); n=\$(echo \$1 | sed -n 's,^r[0-9]\\+-\\([0-9]\\+\\)\$,\\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]*\$,\\1,p;s,^tags/basepoints/gcc-[0-9]\\+\$,0,p'); git rev-parse --verify \$h~\$(expr \$p - \$n); }; f" + # Make diff on MD files uses "(define" as a function marker. # Use this in conjunction with a .gitattributes file containing # *.md diff=md