On Fri, Jan 10, 2020 at 02:26:53PM +0000, Richard Earnshaw (lists) wrote: > Updated to add better support for diff-ing .md files.
The following patch adds the descr/undescr aliases (for converting to monotonically increasing revision numbers and back) there next to svn-rev. Both have been changed to use basepoints/gcc-* tags instead of branchpoints/gcc-*, the first one now supports --full option, where $ git descr origin/master r10-5835 $ git descr --full origin/master r10-5835-g1fc15853e301337b46d7f1234966a6244ef0cdab where the second form is what is used in gcc-cvs mail bodies and bugzilla comments from commits, the former what is used in the subjects. The second alias has been tweaked to use git config --get gcc-config.upstream with fallback to origin to be able to deal with non-default upstream configurations. Ok for trunk once your changes are in (and once the basepoints are pushed into the upstream repository)? 2020-01-13 Jakub Jelinek <ja...@redhat.com> * contrib/gcc-git-customization: Add git descr and undescr aliases. --- contrib/gcc-git-customization.jj 2020-01-12 00:25:19.697684793 +0100 +++ contrib/gcc-git-customization 2020-01-13 12:27:33.154283245 +0100 @@ -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.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.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 Jakub