public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, ray.ni@intel.com,
	Rebecca Cran <rebecca@nuviainc.com>,
	"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"bret.barkelew@microsoft.com" <bret.barkelew@microsoft.com>
Subject: Re: 回复: [edk2-devel] New Year, New PR Thread
Date: Mon, 8 Mar 2021 16:33:35 +0100	[thread overview]
Message-ID: <c7a7749b-60bf-6fd8-b33d-269f91ab687e@redhat.com> (raw)
In-Reply-To: <CO1PR11MB49305B9E097D2E0A44A190BF8C939@CO1PR11MB4930.namprd11.prod.outlook.com>

Hi Ray,

On 03/08/21 13:26, Ni, Ray wrote:
> 
> 
>> -----Original Message-----
>> From: Rebecca Cran <rebecca@nuviainc.com>
>> Sent: Monday, March 8, 2021 10:43 AM
>> To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; gaoliming@byosoft.com.cn; bret.barkelew@microsoft.com
>> Subject: Re: 回复: [edk2-devel] New Year, New PR Thread
>>
>> It was discussed in the recent Community Meeting last week.
>>
>> Now that the stable tag has been created, I believe it's moving forward
>> as the highest priority task (behind, for example, converting the line
>> endings from Windows to UNIX).
> 
> Converting the line endings will cause "git blame" useless because
> every line of code now is changed by someone who changes the line endings.

it doesn't make git-blame useless, just a bit less comfortable.

For example, with master being at 59a3ccb09e7a, assume you run:

  git blame -- BaseTools/Scripts/ConvertFceToStructurePcd.py

and you get an output snippet like

ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 528)     for i in range(len(info_list)-1,-1,-1):
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 529)       if len(info_list[i]) == 0:
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 530)         info_list.remove(info_list[i])
d79b63c64f58a (Leif Lindholm    2019-09-18 22:41:08 +0100 531)     for i in (inf_list, title_all, header_list):
d79b63c64f58a (Leif Lindholm    2019-09-18 22:41:08 +0100 532)       i.sort()
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 533)     return keys,title_all,info_list,header_list,inf_list

Assume you are curious about the "sort" invocation, so you run

  git show d79b63c64f58a

But that only tells you:

commit d79b63c64f58ac47e570e8d2e9b090525f7e8efd
Author: Leif Lindholm <leif.lindholm@linaro.org>
Date:   Wed Sep 18 22:41:08 2019 +0100

    BaseTools: correct line endings for ConvertFce Python script
    
    Cc: Bob Feng <bob.c.feng@intel.com>
    Cc: Liming Gao <liming.gao@intel.com>
    Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
    Reviewed-by: Bob Feng <bob.c.feng@intel.com>
    Reviewed-by: Liming Gao <liming.gao@intel.com>
    Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

So what can we do in this case?

Simple: run git blame "as of the direct parent" of commit d79b63c64f58a:

  git blame d79b63c64f58a^ -- BaseTools/Scripts/ConvertFceToStructurePcd.py

Then you get:

ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 506)     for i in range(len(info_list)-1,-1,-1):
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 507)       if len(info_list[i]) == 0:
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 508)         info_list.remove(info_list[i])
cfb29d2bda57b (Fan, ZhijuX      2019-04-15 16:55:01 +0800 509)     for i in (inf_list, title_all, header_list):
cfb29d2bda57b (Fan, ZhijuX      2019-04-15 16:55:01 +0800 510)       i.sort()
ef529e6ab7c31 (Liming Gao       2018-07-17 11:42:21 +0800 511)     return keys,title_all,info_list,header_list,inf_list

And this time you can run:

  git show cfb29d2bda57b

which gives you the commit you are after:

commit cfb29d2bda57baa344bded40cf12af81b13e8a40
Author: Fan, ZhijuX <zhijux.fan@intel.com>
Date:   Mon Apr 15 16:55:01 2019 +0800

    BaseTools:update ConvertFceToStructurePcd.py with the char order PCD name.
    
    BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1718
    
    BaseTools\Scripts\ConvertFceToStructurePcd.py
    Update script to sort the PCD order base on PcdName,
    then base on Pcd field name.
    
    Cc: Liming Gao <liming.gao@intel.com>
    Contributed-under: TianoCore Contribution Agreement 1.1
    Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
    Reviewed-by: Liming Gao <liming.gao@intel.com>

This command sequence can be repeated as many times as necessary. git-blame gives you a commit, run git-show to check the commit. If the commit is not relevant (i.e., you need to run earlier), re-run git-blame on the same file, but at the *direct parent commit* of the previously used commit, using the caret (^) notation.

It also works if files are renamed (or code is moved between files). In that case, "git-show" will tell you the original file name, so when you run git-blame on the parent commit, you can use the original file name too.

Thanks
Laszlo


      reply	other threads:[~2021-03-08 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 17:10 New Year, New PR Thread Bret Barkelew
2021-03-08  1:20 ` 回复: [edk2-devel] " gaoliming
2021-03-08  2:20   ` Rebecca Cran
2021-03-08  2:31     ` Ni, Ray
2021-03-08  2:43       ` Rebecca Cran
2021-03-08 12:26         ` Ni, Ray
2021-03-08 15:33           ` Laszlo Ersek [this message]

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-list 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=c7a7749b-60bf-6fd8-b33d-269f91ab687e@redhat.com \
    --to=devel@edk2.groups.io \
    /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