public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-7575] contrib: Fix up git-descr.sh regression [PR102664]
Date: Thu, 10 Mar 2022 08:43:28 +0000 (GMT)	[thread overview]
Message-ID: <20220310084328.AB4483858429@sourceware.org> (raw)

https://gcc.gnu.org/g:ff060ef08cfc3e48e70071cb63449b62a86f9d6f

commit r12-7575-gff060ef08cfc3e48e70071cb63449b62a86f9d6f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 10 09:42:03 2022 +0100

    contrib: Fix up git-descr.sh regression [PR102664]
    
    On Wed, Mar 09, 2022 at 12:40:24PM -0500, Patrick Palka via Gcc-patches wrote:
    > On Wed, Mar 9, 2022 at 8:54 AM Mikael Morin <morin-mikael@orange.fr> wrote:
    > > Le 08/03/2022 à 18:58, Jonathan Wakely via Gcc-patches a écrit :
    > > > Replace \([0-9]\+\) with \([0-9][0-9]*\) or with \([1-9][0-9]*\) in release branch numbers, where
    > > > a leading zero does not occur.
    > > >
    > > Note that you also changed some gcc-[0-9]* to gcc-[1-9]*, which is a
    > > typo/thinko I guess?  It looks like it wouldn’t match gcc-10 any more
    > > for example…
    >
    > Perhaps related to this, I noticed the following
    >   git gcc-descr ea1ce0d163ea1d63b6837144ae4be51d92630007
    > now fails with
    >   fatal: No tags can describe 'ea1ce0d163ea1d63b6837144ae4be51d92630007'.
    > instead of outputting
    >   r0-52309-gea1ce0d163ea1d
    
    That is because of those [0-9] to [1-9] changes which prevent
    basepoints/gcc-0 from working.  While basepoints/gcc-005 etc. are certainly
    unexpected, basepoints/gcc-0 needs to work.
    
    2022-03-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR other/102664
            * git-descr.sh: Replace all [1-9] occurrences with [0-9].
            * git-undescr.sh: Likewise.

Diff:
---
 contrib/git-descr.sh   | 6 +++---
 contrib/git-undescr.sh | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/git-descr.sh b/contrib/git-descr.sh
index 95363279d8c..96a993095bd 100755
--- a/contrib/git-descr.sh
+++ b/contrib/git-descr.sh
@@ -18,11 +18,11 @@ do
 done
 
 if test x$short = xyes; then
-    r=$(git describe --all --match 'basepoints/gcc-[1-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-\([1-9][0-9]*\)-\([0-9][0-9]*\)-g[0-9a-f]*$,r\1-\2,p;s,^basepoints/gcc-\([1-9][0-9]*\)$,r\1-0,p');
+    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');
 elif test x$long = xyes; then
-    r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[1-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
+    r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
 else
-    r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[1-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
+    r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^tags/,,;s,^basepoints/gcc-,r,p')
     expr ${r:-no} : 'r[0-9]\+$' >/dev/null && r=${r}-0-g$(git rev-parse $c);
 fi;
 if test -n $r; then
diff --git a/contrib/git-undescr.sh b/contrib/git-undescr.sh
index fd694077467..1db67dc6ebf 100755
--- a/contrib/git-undescr.sh
+++ b/contrib/git-undescr.sh
@@ -3,11 +3,11 @@
 # Script to undescribe a GCC revision
 
 o=$(git config --get gcc-config.upstream);
-r=$(echo $1 | sed -n 's,^r\([1-9][0-9]*\)-[0-9][0-9]*\(-g[0-9a-f]*\)*$,\1,p');
-n=$(echo $1 | sed -n 's,^r[1-9][0-9]*-\([0-9][0-9]*\)\(-g[0-9a-f]*\)*$,\1,p');
+r=$(echo $1 | sed -n 's,^r\([0-9][0-9]*\)-[0-9][0-9]*\(-g[0-9a-f]*\)*$,\1,p');
+n=$(echo $1 | sed -n 's,^r[0-9][0-9]*-\([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/,,;s,^basepoints/gcc-[1-9][0-9]*-\([0-9][0-9]*\)-g[0-9a-f]*$,\1,p;s,^basepoints/gcc-[1-9][0-9]*$,0,p');
+p=$(git describe --all --match 'basepoints/gcc-'$r $h | sed -n 's,^tags/,,;s,^basepoints/gcc-[0-9][0-9]*-\([0-9][0-9]*\)-g[0-9a-f]*$,\1,p;s,^basepoints/gcc-[0-9][0-9]*$,0,p');
 git rev-parse --verify $h~$(expr $p - $n);


                 reply	other threads:[~2022-03-10  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220310084328.AB4483858429@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).