git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can't find the revelant commit with git-log

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Jan 26, 2011, 18:11 UTC
Message-ID
<4D4063EC.7090509@lsrfire.ath.cx>
In-Reply-To
<m239og12pe.fsf@gmail.com>
Am 26.01.2011 09:36, schrieb Francis Moreau:
Show 41 quoted lines
> Francis Moreau <francis.moro@gmail.com> writes:
> 
>> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
>>
>>> 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 ?

I can't see a connection between the two options. Merges are ignored by default (without -m) because they shouldn't contain any changes that aren't already present in one of the merged branches (by convention), and diffs with a single parent are easier to read. This is true with or without -S.

So far we have two action items, I think:
	- Make git grep report non-matching path specs (new feature).
	- Find out why removing the last path component made a
	  difference in the case above (looks like a bug, but I don't
	  understand what's going on).

Taking into account what Johannes said regarding the disappearance of the function during a merge instead of as part of a regular commit, I don't think these changes would help you much with your use case, though. You would still be looking at a complicated net of commits, with the action happening in non-obvious places (merges).

Perhaps --graph can help a bit, see for yourself:
	$ git log --graph -Sblacklist_iommu -m --oneline \
	v2.6.27..v2.6.28 -- drivers/pci/

If you start at v.2.6.26 instead -- e.g. to catch the commit that introduced the function -- then the graph gets a lot more colourful and too complicated, at least for me, though.

René
Previous: Francis MoreauNext: René Scharfe
Message 13 of 30 in “Can't find the revelant commit with git-log”
  1. Francis MoreauJan 25, 2011
  2. René ScharfeJan 25, 2011
  3. Francis MoreauJan 25, 2011
  4. Francis MoreauJan 26, 2011
  5. Johannes SixtJan 26, 2011
  6. Francis MoreauJan 26, 2011
  7. Sverre RabbelierJan 26, 2011
  8. Francis MoreauJan 26, 2011
  9. Sverre RabbelierJan 26, 2011
  10. Francis MoreauJan 26, 2011
  11. Junio C HamanoJan 26, 2011
  12. Francis MoreauJan 26, 2011
  13. René ScharfeJan 26, 2011
  14. René ScharfeJan 28, 2011
  15. Junio C HamanoJan 29, 2011
  16. René ScharfeJan 29, 2011
  17. Junio C HamanoJan 29, 2011
  18. René ScharfeJan 29, 2011
  19. Junio C HamanoFeb 1, 2011
  20. Junio C HamanoFeb 7, 2011
  21. René ScharfeFeb 10, 2011
  22. René ScharfeJan 29, 2011
  23. René ScharfeJan 28, 2011
  24. Francis MoreauJan 29, 2011
  25. René ScharfeJan 29, 2011
  26. Francis MoreauJan 29, 2011
  27. René ScharfeJan 29, 2011
  28. Francis MoreauJan 26, 2011
  29. René ScharfeJan 26, 2011
  30. Francis MoreauJan 26, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.