Thread (8 messages) flat view 8 messages, 4 authors, 2016-06-15

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

From: René Scharfe <hidden>
Date: 2016-06-15 22:50:27

Possibly related (same subject, not in this thread)

Am 26.01.2011 09:36, schrieb Francis Moreau:
Francis Moreau [off-list ref] writes:
quoted
René Scharfe [off-list ref] writes:
quoted
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.
quoted
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é
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help