Commit messages and the move to git

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Tue Dec 3 10:12:00 GMT 2019


On 03/12/2019 09:44, Richard Earnshaw (lists) wrote:
> On 03/12/2019 00:47, Segher Boessenkool wrote:
>> On Mon, Dec 02, 2019 at 08:24:47PM +0000, Joseph Myers wrote:
>>> On Mon, 2 Dec 2019, Segher Boessenkool wrote:
>>>
>>>> Sure; I'm just saying rewriting old commit messages in such a style 
>>>> that
>>>> they keep standing out from new ones is a bit of a weird choice.
>>>
>>> I'd say the rewrites make them stand out *less* (if people avoid having
>>> new commit messages whose summary line is just the ChangeLog header 
>>> line).
>>
>> New commits will not start with [smth] in general.  Of course you *can*
>> do that, with enough effort.  You can also have two consecutive empty
>> lines in your commit messages just fine, but git won't let you without
>> a fight.  This is similar.
>>
>>> Simply having the Legacy-ID in the commit message will be a visible
>>> difference from new commit messages.  But I'm happy it's desirable to 
>>> have
>>> it there, because references to SVN revisions in list archives are so
>>> common and having it in the commit messages makes it very quick and easy
>>> to map to a git commit id, without needing any on-the-side lists of 
>>> commit
>>> mappings or other tools.
>>
>> Yes.  Either in the subject line, or later in the commit message (as
>> with git-svn).  We can quibble about where is best, but (hopefully)
>> everyone agrees we need the SVN id *somewhere* :-)
>>
>>
>> Segher
>>
> 
> With my trial reposurgeon conversion:
> 
>      git log --all --oneline --grep="Legacy-ID: <number>$"
> 
> -all searches all branches, the trailing $ ensures an exact match; 
> --oneline just prints the short summary.
> 
> eg.
> $ git log --oneline --all --grep="Legacy-ID: 278572$"
> 44e365ba66c [backport] quadmath.h (M_Eq, [...]): Use two more decimal 
> places.
> 
> No need to put this in the summary.

Or even:

git config alias.svn-rev '!f() { rev=$1; shift; git log --all --oneline 
--grep="Legacy-ID: $rev$" ${@}; } ; f'

now you can do

$ git svn-rev 278572 --oneline
44e365ba66c [backport] quadmath.h (M_Eq, [...]): Use two more decimal 
places.

or

$ git svn-rev 278572
commit 44e365ba66c6ccf6cb05f75771946d2992bd51c4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Nov 21 18:07:15 2019 +0100

     [backport] quadmath.h (M_Eq, [...]): Use two more decimal places.

             Backported from mainline
             2019-08-02  Jakub Jelinek  <jakub@redhat.com>

             * quadmath.h (M_Eq, M_LOG2Eq, M_LOG10Eq, M_LN2q, M_LN10q, 
M_PIq,
             M_PI_2q, M_PI_4q, M_1_PIq, M_2_PIq, M_2_SQRTPIq, M_SQRT2q,
             M_SQRT1_2q): Use two more decimal places.

     Legacy-ID: 278572

R.



More information about the Gcc mailing list