summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-01-13 15:15:17 +0100
committerJakub Jelinek <jakub@redhat.com>2020-01-13 15:15:17 +0100
commite19db6a2f7aa20b708ffa112767efbd378c94416 (patch)
tree49c4ed8c00d348aba80fe15dd7f30fa57e50dbc8 /contrib
parent743d4d827b8c8215adbe130592e84861c9d4a758 (diff)
contrib: Add git gcc-descr and gcc-undescr aliases.
2020-01-13 Jakub Jelinek <jakub@redhat.com> * contrib/gcc-git-customization.sh: Add git gcc-descr and gcc-undescr aliases.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog5
-rwxr-xr-xcontrib/gcc-git-customization.sh5
2 files changed, 10 insertions, 0 deletions
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 <jakub@redhat.com>
+
+ * contrib/gcc-git-customization.sh: Add git gcc-descr and gcc-undescr
+ aliases.
+
2010-01-13 Richard Earnshaw <rearnsha@arm.com>
* 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