public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Some local customization enhancements when using git
@ 2020-01-10 13:29 Richard Earnshaw (lists)
  2020-01-10 13:30 ` Richard Biener
  2020-01-10 14:27 ` Richard Earnshaw (lists)
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-10 13:29 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

This patch is intended to help with folks setting up a git work 
environment for use with GCC following the transition to git.  It 
currently does a couple of things.

1) Add an alias 'svn-rev' to git so that you can look up a legacy commit 
by its svn revision number.  This enables you to type
git svn-rev 1234
and git will show the commit log entry relating to SVN r1234.

2) Sets up tracking information for the user's private name area in the 
git repo.  It tries to figure out some sensible answers to the data it 
needs, but allows the user to override the values.  It then creates the 
fetch and push entries that are needed for tracking the extra refs. 
This implements one part of the recommendations that I've proposed in 
svnwrite.html for dealing with private branches.

It should be possible to run the script more than once and for it to 
DTRT.  If you change your answers the configuration should be correctly 
updated.

2020-01-10  Richard Earnshaw  <rearnsha@arm.com>

	* gcc-git-customization: New file.


[-- Attachment #2: gcc-git-conf.patch --]
[-- Type: text/x-patch, Size: 1974 bytes --]

diff --git a/contrib/gcc-git-customization b/contrib/gcc-git-customization
new file mode 100755
index 00000000000..7f1a13bdf79
--- /dev/null
+++ b/contrib/gcc-git-customization
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Script to add some local git customizations suitable for working
+# with the GCC git repository
+
+ask () {
+    question=$1
+    default=$2
+    var=$3
+    echo -n $question "["$default"]? "
+    read answer
+    if [ "x$answer" = "x" ]
+    then
+	eval $var=$default
+    else
+	eval $var=$answer
+    fi
+}
+
+# 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'
+
+upstream=`git config --get "gcc-config.upstream"`
+if [ "x$upstream" = "x" ]
+then
+    upstream="origin"
+fi
+ask "Local name for upstream repository" "origin" upstream
+git config "gcc-config.upstream" "$upstream"
+
+remote_id=`git config --get "gcc-config.user"`
+if [ "x$remote_id" = "x" ]
+then
+    # See if the url specifies the remote user name.
+    url=`git config --get "remote.$upstream.url"`
+    if [ "x$url" = "x" ]
+    then
+	# This is a pure guess, but for many people it might be OK.
+	remote_id=`whoami`
+    else
+	remote_id=`echo $url | sed -r "s|^.*ssh://(.+)@gcc.gnu.org.*$|\1|"`
+	if [ x$remote_id = x$url ]
+	then
+	    remote_id=`whoami`
+	fi
+    fi
+fi
+ask "Account name on gcc.gnu.org" $remote_id remote_id
+git config "gcc-config.user" "$remote_id"
+
+echo "Setting up tracking for private namespace $remote_id in remotes/$upstream/me"
+git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/heads/*:refs/remotes/${upstream}/me/*" ":refs/remotes/${upstream}/me/"
+git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/tags/*:refs/tags/me/*" ":refs/tags/me/"
+git config --replace-all "remote.${upstream}.push" "+refs/heads/me/*:refs/users/${remote_id}/heads/*" "^\+refs/heads/me/"

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-10 13:29 Some local customization enhancements when using git Richard Earnshaw (lists)
@ 2020-01-10 13:30 ` Richard Biener
  2020-01-10 14:04   ` Richard Earnshaw (lists)
  2020-01-10 14:27 ` Richard Earnshaw (lists)
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Biener @ 2020-01-10 13:30 UTC (permalink / raw)
  To: Richard Earnshaw (lists); +Cc: gcc-patches

On Fri, Jan 10, 2020 at 2:23 PM Richard Earnshaw (lists)
<Richard.Earnshaw@arm.com> wrote:
>
> This patch is intended to help with folks setting up a git work
> environment for use with GCC following the transition to git.  It
> currently does a couple of things.
>
> 1) Add an alias 'svn-rev' to git so that you can look up a legacy commit
> by its svn revision number.  This enables you to type
> git svn-rev 1234
> and git will show the commit log entry relating to SVN r1234.
>
> 2) Sets up tracking information for the user's private name area in the
> git repo.  It tries to figure out some sensible answers to the data it
> needs, but allows the user to override the values.  It then creates the
> fetch and push entries that are needed for tracking the extra refs.
> This implements one part of the recommendations that I've proposed in
> svnwrite.html for dealing with private branches.
>
> It should be possible to run the script more than once and for it to
> DTRT.  If you change your answers the configuration should be correctly
> updated.

I assume the script is invoked from a clone of the new (final) repo.  Does it
need to be cloned in any special way?

Richard.

> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
>
>         * gcc-git-customization: New file.
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-10 13:30 ` Richard Biener
@ 2020-01-10 14:04   ` Richard Earnshaw (lists)
  2020-01-10 14:13     ` Richard Earnshaw (lists)
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-10 14:04 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On 10/01/2020 13:29, Richard Biener wrote:
> On Fri, Jan 10, 2020 at 2:23 PM Richard Earnshaw (lists)
> <Richard.Earnshaw@arm.com> wrote:
>>
>> This patch is intended to help with folks setting up a git work
>> environment for use with GCC following the transition to git.  It
>> currently does a couple of things.
>>
>> 1) Add an alias 'svn-rev' to git so that you can look up a legacy commit
>> by its svn revision number.  This enables you to type
>> git svn-rev 1234
>> and git will show the commit log entry relating to SVN r1234.
>>
>> 2) Sets up tracking information for the user's private name area in the
>> git repo.  It tries to figure out some sensible answers to the data it
>> needs, but allows the user to override the values.  It then creates the
>> fetch and push entries that are needed for tracking the extra refs.
>> This implements one part of the recommendations that I've proposed in
>> svnwrite.html for dealing with private branches.
>>
>> It should be possible to run the script more than once and for it to
>> DTRT.  If you change your answers the configuration should be correctly
>> updated.
> 
> I assume the script is invoked from a clone of the new (final) repo.  Does it
> need to be cloned in any special way?
> 
> Richard.
> 
>> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
>>
>>          * gcc-git-customization: New file.
>>

You can run the script after doing a clone.  It adds the bits that a 
normal clone would not.  I don't know if there's any way of hooking git 
to run this automatically, but I'm not sure if that would be a good idea 
anyway, since that would break non-interactive cloning.

R.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-10 14:04   ` Richard Earnshaw (lists)
@ 2020-01-10 14:13     ` Richard Earnshaw (lists)
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-10 14:13 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On 10/01/2020 14:01, Richard Earnshaw (lists) wrote:
> On 10/01/2020 13:29, Richard Biener wrote:
>> On Fri, Jan 10, 2020 at 2:23 PM Richard Earnshaw (lists)
>> <Richard.Earnshaw@arm.com> wrote:
>>>
>>> This patch is intended to help with folks setting up a git work
>>> environment for use with GCC following the transition to git.  It
>>> currently does a couple of things.
>>>
>>> 1) Add an alias 'svn-rev' to git so that you can look up a legacy commit
>>> by its svn revision number.  This enables you to type
>>> git svn-rev 1234
>>> and git will show the commit log entry relating to SVN r1234.
>>>
>>> 2) Sets up tracking information for the user's private name area in the
>>> git repo.  It tries to figure out some sensible answers to the data it
>>> needs, but allows the user to override the values.  It then creates the
>>> fetch and push entries that are needed for tracking the extra refs.
>>> This implements one part of the recommendations that I've proposed in
>>> svnwrite.html for dealing with private branches.
>>>
>>> It should be possible to run the script more than once and for it to
>>> DTRT.  If you change your answers the configuration should be correctly
>>> updated.
>>
>> I assume the script is invoked from a clone of the new (final) repo.  
>> Does it
>> need to be cloned in any special way?
>>
>> Richard.
>>
>>> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
>>>
>>>          * gcc-git-customization: New file.
>>>
> 
> You can run the script after doing a clone.  It adds the bits that a 
> normal clone would not.  I don't know if there's any way of hooking git 
> to run this automatically, but I'm not sure if that would be a good idea 
> anyway, since that would break non-interactive cloning.
> 
> R.

The expected using is:

$ git clone git+svn://{id}@gcc.gnu.org/git/gcc
$ cd gcc
$ contrib/gcc-git-customization
# Now pull the additional refs
$ git fetch

R.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-10 13:29 Some local customization enhancements when using git Richard Earnshaw (lists)
  2020-01-10 13:30 ` Richard Biener
@ 2020-01-10 14:27 ` Richard Earnshaw (lists)
  2020-01-13 12:50   ` [PATCH] contrib: git descr/undescr aliases Jakub Jelinek
  2020-01-13 14:02   ` Some local customization enhancements when using git Richard Earnshaw (lists)
  1 sibling, 2 replies; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-10 14:27 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

On 10/01/2020 13:23, Richard Earnshaw (lists) wrote:
> This patch is intended to help with folks setting up a git work 
> environment for use with GCC following the transition to git.  It 
> currently does a couple of things.
> 
> 1) Add an alias 'svn-rev' to git so that you can look up a legacy commit 
> by its svn revision number.  This enables you to type
> git svn-rev 1234
> and git will show the commit log entry relating to SVN r1234.
> 
> 2) Sets up tracking information for the user's private name area in the 
> git repo.  It tries to figure out some sensible answers to the data it 
> needs, but allows the user to override the values.  It then creates the 
> fetch and push entries that are needed for tracking the extra refs. This 
> implements one part of the recommendations that I've proposed in 
> svnwrite.html for dealing with private branches.
> 
> It should be possible to run the script more than once and for it to 
> DTRT.  If you change your answers the configuration should be correctly 
> updated.
> 
> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
> 
>      * gcc-git-customization: New file.
> 

Updated to add better support for diff-ing .md files.

R.

[-- Attachment #2: gcc-git-conf.patch --]
[-- Type: text/x-patch, Size: 2167 bytes --]

diff --git a/contrib/gcc-git-customization b/contrib/gcc-git-customization
new file mode 100755
index 00000000000..fd3c560f3ae
--- /dev/null
+++ b/contrib/gcc-git-customization
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# Script to add some local git customizations suitable for working
+# with the GCC git repository
+
+ask () {
+    question=$1
+    default=$2
+    var=$3
+    echo -n $question "["$default"]? "
+    read answer
+    if [ "x$answer" = "x" ]
+    then
+	eval $var=$default
+    else
+	eval $var=$answer
+    fi
+}
+
+# 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'
+
+# Make diff on MD files uses "(define" as a function marker.
+# Use this in conjunction with a .gitattributes file containing
+# *.md    diff=md
+git config diff.md.xfuncname '^\(define.*$'
+
+upstream=`git config --get "gcc-config.upstream"`
+if [ "x$upstream" = "x" ]
+then
+    upstream="origin"
+fi
+ask "Local name for upstream repository" "origin" upstream
+git config "gcc-config.upstream" "$upstream"
+
+remote_id=`git config --get "gcc-config.user"`
+if [ "x$remote_id" = "x" ]
+then
+    # See if the url specifies the remote user name.
+    url=`git config --get "remote.$upstream.url"`
+    if [ "x$url" = "x" ]
+    then
+	# This is a pure guess, but for many people it might be OK.
+	remote_id=`whoami`
+    else
+	remote_id=`echo $url | sed -r "s|^.*ssh://(.+)@gcc.gnu.org.*$|\1|"`
+	if [ x$remote_id = x$url ]
+	then
+	    remote_id=`whoami`
+	fi
+    fi
+fi
+ask "Account name on gcc.gnu.org" $remote_id remote_id
+git config "gcc-config.user" "$remote_id"
+
+echo "Setting up tracking for private namespace $remote_id in remotes/$upstream/me"
+git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/heads/*:refs/remotes/${upstream}/me/*" ":refs/remotes/${upstream}/me/"
+git config --replace-all "remote.${upstream}.fetch" "+refs/users/${remote_id}/tags/*:refs/tags/me/*" ":refs/tags/me/"
+git config --replace-all "remote.${upstream}.push" "+refs/heads/me/*:refs/users/${remote_id}/heads/*" "^\+refs/heads/me/"

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] contrib: git descr/undescr aliases
  2020-01-10 14:27 ` Richard Earnshaw (lists)
@ 2020-01-13 12:50   ` Jakub Jelinek
  2020-01-14 10:18     ` Roman Zhuykov
  2020-01-13 14:02   ` Some local customization enhancements when using git Richard Earnshaw (lists)
  1 sibling, 1 reply; 13+ messages in thread
From: Jakub Jelinek @ 2020-01-13 12:50 UTC (permalink / raw)
  To: Richard Earnshaw (lists); +Cc: gcc-patches

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  <jakub@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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-10 14:27 ` Richard Earnshaw (lists)
  2020-01-13 12:50   ` [PATCH] contrib: git descr/undescr aliases Jakub Jelinek
@ 2020-01-13 14:02   ` Richard Earnshaw (lists)
  2020-01-13 16:03     ` Richard Earnshaw (lists)
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-13 14:02 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

On 10/01/2020 14:26, Richard Earnshaw (lists) wrote:
> On 10/01/2020 13:23, Richard Earnshaw (lists) wrote:
>> This patch is intended to help with folks setting up a git work
>> environment for use with GCC following the transition to git.  It
>> currently does a couple of things.
>>
>> 1) Add an alias 'svn-rev' to git so that you can look up a legacy
>> commit by its svn revision number.  This enables you to type
>> git svn-rev 1234
>> and git will show the commit log entry relating to SVN r1234.
>>
>> 2) Sets up tracking information for the user's private name area in
>> the git repo.  It tries to figure out some sensible answers to the
>> data it needs, but allows the user to override the values.  It then
>> creates the fetch and push entries that are needed for tracking the
>> extra refs. This implements one part of the recommendations that I've
>> proposed in svnwrite.html for dealing with private branches.
>>
>> It should be possible to run the script more than once and for it to
>> DTRT.  If you change your answers the configuration should be
>> correctly updated.
>>
>> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
>>
>>      * gcc-git-customization: New file.
>>
> 
> Updated to add better support for diff-ing .md files.
> 
> R.

A couple more tweaks to this file and I've now checked it in.

1) Added the ability to select the prefix for the personal namespace.
This will be cached.  If you change it, then the push operations will be
updated (but any local branches you will have to rename if you want them
to continue working afterwards).
2) Removed the + from the added push spec.

R.


[-- Attachment #2: gcc-git-customization.sh --]
[-- Type: application/x-shellscript, Size: 2312 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Some local customization enhancements when using git
  2020-01-13 14:02   ` Some local customization enhancements when using git Richard Earnshaw (lists)
@ 2020-01-13 16:03     ` Richard Earnshaw (lists)
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-13 16:03 UTC (permalink / raw)
  To: gcc-patches

On 13/01/2020 13:44, Richard Earnshaw (lists) wrote:
> On 10/01/2020 14:26, Richard Earnshaw (lists) wrote:
>> On 10/01/2020 13:23, Richard Earnshaw (lists) wrote:
>>> This patch is intended to help with folks setting up a git work
>>> environment for use with GCC following the transition to git.  It
>>> currently does a couple of things.
>>>
>>> 1) Add an alias 'svn-rev' to git so that you can look up a legacy
>>> commit by its svn revision number.  This enables you to type
>>> git svn-rev 1234
>>> and git will show the commit log entry relating to SVN r1234.
>>>
>>> 2) Sets up tracking information for the user's private name area in
>>> the git repo.  It tries to figure out some sensible answers to the
>>> data it needs, but allows the user to override the values.  It then
>>> creates the fetch and push entries that are needed for tracking the
>>> extra refs. This implements one part of the recommendations that I've
>>> proposed in svnwrite.html for dealing with private branches.
>>>
>>> It should be possible to run the script more than once and for it to
>>> DTRT.  If you change your answers the configuration should be
>>> correctly updated.
>>>
>>> 2020-01-10  Richard Earnshaw  <rearnsha@arm.com>
>>>
>>>      * gcc-git-customization: New file.
>>>
>>
>> Updated to add better support for diff-ing .md files.
>>
>> R.
> 
> A couple more tweaks to this file and I've now checked it in.
> 
> 1) Added the ability to select the prefix for the personal namespace.
> This will be cached.  If you change it, then the push operations will be
> updated (but any local branches you will have to rename if you want them
> to continue working afterwards).
> 2) Removed the + from the added push spec.
> 

And one more tweak I forgot to mention:

3) an optional 'r' can now be used in front of an svn revision number in
'git svn-rev'.

> R.
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] contrib: git descr/undescr aliases
  2020-01-13 12:50   ` [PATCH] contrib: git descr/undescr aliases Jakub Jelinek
@ 2020-01-14 10:18     ` Roman Zhuykov
  2020-01-14 10:22       ` Jakub Jelinek
  2020-01-14 23:39       ` [PATCH] contrib: git descr/undescr aliases Joseph Myers
  0 siblings, 2 replies; 13+ messages in thread
From: Roman Zhuykov @ 2020-01-14 10:18 UTC (permalink / raw)
  To: Jakub Jelinek, Richard Earnshaw (lists); +Cc: gcc-patches

13.01.2020 14:37, Jakub Jelinek wrote:
> 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.
>
It was a bit confusing to see "git descr" here in posted patch and "git 
gcc-descr" actually committed.
Moreover "git gcc-descr" doesn't work for me with old git:

~$ git --version
git version 2.7.4
~$ git clone git://gcc.gnu.org/git/gcc test
<...>
~$ cd test/
~/test$
~/test$ ./contrib/gcc-git-customization.sh
<...>
~/test$ git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' origin/master
basepoints/gcc-10-5938-gedabbec31e3bfc9a9757f80c8610706ed00e5a1a
~/test$ git gcc-descr origin/master
~/test$

So, locally I have to fix alias removing "tags/" part in commands like "sed -n 's,^tags/basepoints/gcc-,r,p'".

With new git v2.24.0 alias works fine.  Investigation shows it was changed inside git by commit https://github.com/git/git/commit/1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2 two years ago.  So, only git v2.16.2, v2.17.0 or newer versions correctly run current alias.  Not sure we want to bother about supporting older versions.

--
Roman


PS. We at ISPRAS see that for ~28 hours (11 Jan 2020, 18:00 UTC - 12 Jan 2020, 22:00 UTC) our servers haven't received any gcc mailing list letters, but they are available at https://gcc.gnu.org/ml/ archives (totally 6 mails on gcc@ and 16 on gcc-patches@ were lost).  Looking also at obviously corruptedhttps://gcc.gnu.org/ml/gcc-patches/2020-01/msg00674.html  it is reasonable to assume that it was some worldwide issue because of high "git clone" server load, and I wonder not to see any discussion here.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] contrib: git descr/undescr aliases
  2020-01-14 10:18     ` Roman Zhuykov
@ 2020-01-14 10:22       ` Jakub Jelinek
  2020-01-14 23:50         ` [PATCH] contrib: git descr/undescr aliases fix for older git Jakub Jelinek
  2020-01-14 23:39       ` [PATCH] contrib: git descr/undescr aliases Joseph Myers
  1 sibling, 1 reply; 13+ messages in thread
From: Jakub Jelinek @ 2020-01-14 10:22 UTC (permalink / raw)
  To: Roman Zhuykov; +Cc: Richard Earnshaw (lists), gcc-patches

On Tue, Jan 14, 2020 at 12:04:04PM +0300, Roman Zhuykov wrote:
> It was a bit confusing to see "git descr" here in posted patch and "git
> gcc-descr" actually committed.

That was an IRC request from Richard Earnshaw.

> Moreover "git gcc-descr" doesn't work for me with old git:
> 
> ~$ git --version
> git version 2.7.4
> ~$ git clone git://gcc.gnu.org/git/gcc test
> <...>
> ~$ cd test/
> ~/test$
> ~/test$ ./contrib/gcc-git-customization.sh
> <...>
> ~/test$ git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' origin/master
> basepoints/gcc-10-5938-gedabbec31e3bfc9a9757f80c8610706ed00e5a1a
> ~/test$ git gcc-descr origin/master
> ~/test$
> 
> So, locally I have to fix alias removing "tags/" part in commands like "sed -n 's,^tags/basepoints/gcc-,r,p'".
> 
> With new git v2.24.0 alias works fine.  Investigation shows it was changed inside git by commit https://github.com/git/git/commit/1bba00130a1a0332ec0ad2f878a09ca9b2b18ee2 two years ago.  So, only git v2.16.2, v2.17.0 or newer versions correctly run current alias.  Not sure we want to bother about supporting older versions.

Note, for the scripts running on sourceware I also had to remove those tags/
part, but thought it is because of running against the bare repo.
We could change those into ^\\(tags/\\)\\?basepoints/gcc- etc. (and adjust
the \\1.
I'll post a patch.

> PS. We at ISPRAS see that for ~28 hours (11 Jan 2020, 18:00 UTC - 12 Jan 2020, 22:00 UTC) our servers haven't received any gcc mailing list letters, but they are available at https://gcc.gnu.org/ml/ archives (totally 6 mails on gcc@ and 16 on gcc-patches@ were lost).  Looking also at obviously corruptedhttps://gcc.gnu.org/ml/gcc-patches/2020-01/msg00674.html  it is reasonable to assume that it was some worldwide issue because of high "git clone" server load, and I wonder not to see any discussion here.

Strange, I certainly am receiving gcc mailing list mails.

	Jakub

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] contrib: git descr/undescr aliases
  2020-01-14 10:18     ` Roman Zhuykov
  2020-01-14 10:22       ` Jakub Jelinek
@ 2020-01-14 23:39       ` Joseph Myers
  1 sibling, 0 replies; 13+ messages in thread
From: Joseph Myers @ 2020-01-14 23:39 UTC (permalink / raw)
  To: Roman Zhuykov; +Cc: Jakub Jelinek, Richard Earnshaw (lists), gcc-patches

On Tue, 14 Jan 2020, Roman Zhuykov wrote:

> PS. We at ISPRAS see that for ~28 hours (11 Jan 2020, 18:00 UTC - 12 Jan 2020,
> 22:00 UTC) our servers haven't received any gcc mailing list letters, but they
> are available at https://gcc.gnu.org/ml/ archives (totally 6 mails on gcc@ and
> 16 on gcc-patches@ were lost).  Looking also at obviously
> corruptedhttps://gcc.gnu.org/ml/gcc-patches/2020-01/msg00674.html  it is
> reasonable to assume that it was some worldwide issue because of high "git
> clone" server load, and I wonder not to see any discussion here.

Sourceware was on the CBL <https://www.abuseat.org/> at that time until I 
noticed (via email delays, since my mail server uses some DNSBLs as a 
basis for greylisting) and removed it.  I don't know why it got listed but 
have no reason to think it related to the high load on the system.  
Probably your mail server uses the CBL, or another DNSBL containing it, as 
a basis for rejecting email.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] contrib: git descr/undescr aliases fix for older git
  2020-01-14 10:22       ` Jakub Jelinek
@ 2020-01-14 23:50         ` Jakub Jelinek
  2020-01-15 11:34           ` Richard Earnshaw (lists)
  0 siblings, 1 reply; 13+ messages in thread
From: Jakub Jelinek @ 2020-01-14 23:50 UTC (permalink / raw)
  To: Joseph S. Myers, Richard Earnshaw (lists), Roman Zhuykov; +Cc: gcc-patches

On Tue, Jan 14, 2020 at 10:12:09AM +0100, Jakub Jelinek wrote:
> Note, for the scripts running on sourceware I also had to remove those tags/
> part, but thought it is because of running against the bare repo.
> We could change those into ^\\(tags/\\)\\?basepoints/gcc- etc. (and adjust
> the \\1.
> I'll post a patch.

Here it is, tested on x86_64-linux, ok for trunk?

2020-01-15  Jakub Jelinek  <jakub@redhat.com>

	* gcc-git-customization.sh: Handle output of older git which doesn't
	print tags/ prefixes before branchpoint/gcc-.

--- contrib/gcc-git-customization.sh.jj	2020-01-13 15:15:00.472393417 +0100
+++ contrib/gcc-git-customization.sh	2020-01-14 15:09:33.364634082 +0100
@@ -22,8 +22,8 @@ git config alias.svn-rev '!f() { rev=$1;
 
 # 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"
+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\\2-\\3,p;s,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)\$,r\\2-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]*\$,\\2,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


	Jakub

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] contrib: git descr/undescr aliases fix for older git
  2020-01-14 23:50         ` [PATCH] contrib: git descr/undescr aliases fix for older git Jakub Jelinek
@ 2020-01-15 11:34           ` Richard Earnshaw (lists)
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Earnshaw (lists) @ 2020-01-15 11:34 UTC (permalink / raw)
  To: Jakub Jelinek, Joseph S. Myers, Roman Zhuykov; +Cc: gcc-patches

On 14/01/2020 23:44, Jakub Jelinek wrote:
> On Tue, Jan 14, 2020 at 10:12:09AM +0100, Jakub Jelinek wrote:
>> Note, for the scripts running on sourceware I also had to remove those tags/
>> part, but thought it is because of running against the bare repo.
>> We could change those into ^\\(tags/\\)\\?basepoints/gcc- etc. (and adjust
>> the \\1.
>> I'll post a patch.
> 
> Here it is, tested on x86_64-linux, ok for trunk?
> 
> 2020-01-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* gcc-git-customization.sh: Handle output of older git which doesn't
> 	print tags/ prefixes before branchpoint/gcc-.
> 
> --- contrib/gcc-git-customization.sh.jj	2020-01-13 15:15:00.472393417 +0100
> +++ contrib/gcc-git-customization.sh	2020-01-14 15:09:33.364634082 +0100
> @@ -22,8 +22,8 @@ git config alias.svn-rev '!f() { rev=$1;
>   
>   # 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"
> +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\\2-\\3,p;s,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)\$,r\\2-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]*\$,\\2,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
> 
> 
> 	Jakub
> 

I'm not going to pretend I understand all that foo. But these are your 
aliases anyway.

OK.

R.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-01-15 10:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 13:29 Some local customization enhancements when using git Richard Earnshaw (lists)
2020-01-10 13:30 ` Richard Biener
2020-01-10 14:04   ` Richard Earnshaw (lists)
2020-01-10 14:13     ` Richard Earnshaw (lists)
2020-01-10 14:27 ` Richard Earnshaw (lists)
2020-01-13 12:50   ` [PATCH] contrib: git descr/undescr aliases Jakub Jelinek
2020-01-14 10:18     ` Roman Zhuykov
2020-01-14 10:22       ` Jakub Jelinek
2020-01-14 23:50         ` [PATCH] contrib: git descr/undescr aliases fix for older git Jakub Jelinek
2020-01-15 11:34           ` Richard Earnshaw (lists)
2020-01-14 23:39       ` [PATCH] contrib: git descr/undescr aliases Joseph Myers
2020-01-13 14:02   ` Some local customization enhancements when using git Richard Earnshaw (lists)
2020-01-13 16:03     ` Richard Earnshaw (lists)

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).