git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Francis Moreau <francis.moro@gmail.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: git@vger.kernel.org
Subject: Re: Can't find the revelant commit with git-log
Date: Wed, 26 Jan 2011 09:36:29 +0100	[thread overview]
Message-ID: <m239og12pe.fsf@gmail.com> (raw)
In-Reply-To: <m2ipxc27zi.fsf@gmail.com> (Francis Moreau's message of "Tue, 25 Jan 2011 18:44:49 +0100")

Francis Moreau <francis.moro@gmail.com> writes:

> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
>
>> Am 25.01.2011 10:01, schrieb Francis Moreau:
>>>
>>> The project is the Linux kernel, and I'm trying to look for changes
>>> which happened between v2.6.27 and v2.6.28. The changes happened in the
>>> following file: drivers/pci/intel-iommu.c where a function has been
>>> removed:
>>> 
>>>    $ git --version
>>>    git version 1.7.4.rc3
>>> 
>>>    $ cd ~/linux-2.6/drivers/pci/
>>>    $ git grep blacklist v2.6.27 -- drivers/pci/intel-iommu.c
>>>    $
>>> 
>>> No ouput... hmm, I know it's in... oh maybe the path is incorrect
>>> 
>>>    $ git git grep blacklist v2.6.27 -- intel-iommu.c
>>>    v2.6.27:intel-iommu.c:static int blacklist_iommu(const struct dmi_system_id *id)
>>>    v2.6.27:intel-iommu.c:          .callback = blacklist_iommu,
>>> 
>>> ah, so Git failed previously without any comments on the wrong
>>> path... maybe it should ?
>>
>> Good idea.
>>
>
> Actually I _think_ I encoutered this behaviour for other commands as well,
> like git-show or git-log, I don't remember.
>
>>
>>> So at that point I know that in the revision v2.6.27, there's a function
>>> called "blacklist_iommu" in drivers/pci/intel-iommu.c
>>> 
>>> Now take a look if it's still there in v2.6.28:
>>> 
>>>    $ git git grep blacklist v2.6.28 -- intel-iommu.c
>>>    $
>>> 
>>> This time nothing is printed but I know that the command is correct.
>>> 
>>> So now I'm interested in looking for the commit which removed this
>>> function. Fo this I'm trying to use git-log(1):
>>> 
>>>    $ git log --full-history --follow -S'static int blacklist_iommu(const struct dmi_system_id *id)' v2.6.27..v2.6.28 -- intel-iommu.c
>>>    $ echo $?
>>>    0
>>> 
>>> I tried different options but it fails.
>>> 
>>> Also I found that passing the exact string to '-S' is annoying, are
>>> there any way to just pass a part of the string such as
>>> "-Sblacklist_iommu" ?
>>
>> This (-Sblacklist_iommu) works for me.
>>
>
> Hmm, I thought I tried this and it didn't work, but that's obviously
> wrong.
>
>>
>>> Sorry if I miss the revelant git-log's option, but there're so many...
>>
>> Try -m (show full diff for merge commits), as the change you're looking
>> for seems to have been introduced by a merge, not a regular commit.
>>
>> 	$ opts="--stat -Sblacklist_iommu -m --oneline"
>> 	$ revs="v2.6.27..v2.6.28"
>>
>> 	$ git log $opts $revs -- drivers/pci/intel-iommu.c
>>
>> This returns nothing.  Hmm.  Let's try this instead:
>>
>> 	$ git log $opts $revs -- drivers/pci/
>> 	057316c (from 3e2dab9) Merge branch 'linus' into test
>> 	 drivers/pci/intel-iommu.c |  307 ++++++++++++++++++++------------------------
>> 	 1 files changed, 140 insertions(+), 167 deletions(-)
>> 	6b2ada8 (from 3b7ecb5) Merge branches 'core/softlockup', 'core/softirq', 'core/resources', 'core/printk' and 'core/misc' into core-v28-for-linus
>> 	 drivers/pci/intel-iommu.c |  187 ++++++--------------------------------------
>> 	 1 files changed, 26 insertions(+), 161 deletions(-)
>> 	d847059 (from 725c258) Merge branch 'x86/apic' into x86-v28-for-linus-phase4-B
>> 	 drivers/pci/intel-iommu.c |  185 ++++++---------------------------------------
>> 	 1 files changed, 25 insertions(+), 160 deletions(-)
>> 	725c258 (from 129d6ab) Merge branches 'core/iommu', 'x86/amd-iommu' and 'x86/iommu' into x86-v28-for-linus-phase3-B
>> 	 drivers/pci/intel-iommu.c |   25 ++++++++++++++++++++++++-
>> 	 1 files changed, 24 insertions(+), 1 deletions(-)
>> 	6e03f99 (from 9821626) Merge branch 'linus' into x86/iommu
>> 	 drivers/pci/intel-iommu.c |   23 +++++++++++++++++++++++
>> 	 1 files changed, 23 insertions(+), 0 deletions(-)
>>
>> Strange, why did we need to remove the last path component to get these
>> results which say that exactly the file we previously specified was changed?
>
> ah... I think I've been hit by this, since I tried '-m' too but see
> nothing and was not smart enough to remove the filename from the path.
>
>> Also interesting, and matching the above results in that we see the need for
>> the -m flag confirmed:

BTW, couldn't '-m' automatically set when '-S' is given ?

>> 
>>
>> 	$ for merge in 057316c 6b2ada8 d847059 725c258 6e03f99
>> 	do
>> 		a=$(git show $merge | grep -c blacklist_iommu)
>> 		b=$(git show -m $merge | grep -c blacklist_iommu)
>> 		echo $merge $a $b
>> 	done
>> 	057316c 0 2
>> 	6b2ada8 0 2
>> 	d847059 0 2
>> 	725c258 0 2
>> 	6e03f99 0 2
>>
>> IAW: the combined diff for the five found merges doesn't show any changes to
>> a line containing the string "blacklist_iommu", but the full diffs do.
>>
>> Let's check for the presence of the string in the merge results and their
>> parents:
>>
>> 	$ for merge in 057316c 6b2ada8 d847059 725c258 6e03f99
>> 	  do
>> 		for rev in $(git show $merge | grep ^Merge:)
>> 		do
>> 			t=parent
>> 			case $rev in
>> 			Merge:)
>> 				echo
>> 				rev=$merge
>> 				t=merge
>> 				;;
>> 			esac
>> 			if git grep -q blacklist_iommu $rev -- drivers/pci/
>> 			then
>> 				echo "$t $rev: found"
>> 			else
>> 				echo "$t $rev: not found"
>> 			fi
>> 		done
>> 	done
>>
>> 	merge 057316c: not found
>> 	parent 3e2dab9: found
>> 	parent 2515ddc: not found
>> 	
>> 	merge 6b2ada8: not found
>> 	parent 278429c: not found
>> 	parent 3b7ecb5: found
>> 	parent 77af7e3: not found
>> 	parent 1516071: not found
>> 	parent 1fa63a8: not found
>> 	parent 8546232: not found
>> 	
>> 	merge d847059: not found
>> 	parent 725c258: found
>> 	parent 11494547: not found
>> 	
>> 	merge 725c258: found
>> 	parent 3dd392a: found
>> 	parent 72d3105: found
>> 	parent 129d6ab: not found
>> 	parent 1e19b16: found
>> 	
>> 	merge 6e03f99: found
>> 	parent 9821626: not found
>> 	parent 6bfb09a: found
>>
>> Hmm, seems like the function is gone since d847059.  Does all of this help
>> you in any way?
>
> Yes it does, but one question I'm wondering is: is it possible to do
> this more user friendly ? ;)

I tried to reproduce something similar but with a far more simple repo:


<v2.6.28> 1.f o
              |
          1.e o (merge)
              | \
          1.d o  o 2.c (merge)
              |  | \
          1.c o  o  o 3.a "Remove blacklist_iommu()"
              |  | /
              |  o 2.a
              | /
          1.b o
              |
<v2.6.27> 1.a o "Introduce blacklist_iommu()"
              |
              o Init

Basically this repo 3 branches: master, 2, 3. Master branch introduces
the "blacklist_iommu()" function with commit 1.a, and branch "3" removes
it at commit 3.a.

So now:

   $ git log --oneline -S"blacklist_iommu"
   ea1ddb0 3.a
   8053460 1.a


   $ git show :/3.a
   commit ea1ddb023833470be173363a71a3a055ae8acb85
   Author: Francis Moreau <fmoreau@spoutnik.(none)>
   Date:   Wed Jan 26 09:17:58 2011 +0100
   
       3.a
       
       Remove blacklist_iommy()
   
   diff --git a/intel-iommu.c b/intel-iommu.c
   index 2c9539d..f19c1cc 100644
   --- a/intel-iommu.c
   +++ b/intel-iommu.c
   @@ -2,12 +2,4 @@ Wed Jan 26 09:10:15 CET 2011
    Wed Jan 26 09:16:23 CET 2011
    
    
   -static int blacklist_iommu(const struct dmi_system_id *id)
   -{
   -  printk(KERN_INFO "%s detected; disabling IOMMU\n",
   -	 id->ident);
   -  dmar_disabled = 1;
   -  return 0;
   -}
   -
    Wed Jan 26 09:14:40 CET 2011

So in this case there's no need to pass the '-m' flag and git-log(1), by
default walks through all the commits:

   $ git log --oneline v2.6.27..v2.6.28
   e2a5af3 1.e
   c9fbd3a Merge branch '2'
   a8207d9 Merge branch '3' into 2
   ea1ddb0 3.a
   3a86ada 2.b
   767186a 2.a
   45beaac 1.d
   1af781c 1.c
   4f9b5c1 1.b
   8053460 1.a

whereas in my previous example, it doesn't seem to be true.

Could you shed some light ?

Thanks
-- 
Francis

  reply	other threads:[~2011-01-26  8:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25  9:01 Can't find the revelant commit with git-log Francis Moreau
2011-01-25 16:12 ` René Scharfe
2011-01-25 17:44   ` Francis Moreau
2011-01-26  8:36     ` Francis Moreau [this message]
2011-01-26 10:44       ` Johannes Sixt
2011-01-26 20:56         ` Francis Moreau
2011-01-26 21:03           ` Sverre Rabbelier
2011-01-26 21:08             ` Francis Moreau
2011-01-26 21:14               ` Sverre Rabbelier
2011-01-26 21:31                 ` Francis Moreau
2011-01-26 21:24               ` Junio C Hamano
2011-01-26 21:32                 ` Francis Moreau
2011-01-26 18:11       ` René Scharfe
2011-01-28 20:29         ` René Scharfe
2011-01-29  0:02           ` Junio C Hamano
2011-01-29  2:34             ` René Scharfe
2011-01-29  5:47               ` Junio C Hamano
2011-01-29 20:26                 ` René Scharfe
2011-02-01 21:28                   ` Junio C Hamano
2011-02-07 22:51                   ` Junio C Hamano
2011-02-10 18:50                     ` René Scharfe
2011-01-29 20:26               ` René Scharfe
2011-01-28 22:01         ` René Scharfe
2011-01-29 12:52           ` Francis Moreau
2011-01-29 13:02             ` René Scharfe
2011-01-29 13:57               ` Francis Moreau
2011-01-29 15:17                 ` René Scharfe
2011-01-26  9:01   ` Francis Moreau
2011-01-26 18:39     ` René Scharfe
2011-01-26 19:50       ` Francis Moreau

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=m239og12pe.fsf@gmail.com \
    --to=francis.moro@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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