threads / discuss / 12391

Anomaly in git log?

Subject: Anomaly in git log?

## tl;dr

2 messages between Mar 1, 2008 and Mar 1, 2008.

replies: 1people: 2as markdown or json

Stephen Rothwell· Mar 1, 2008, 02:35 UTC · lore
Hi,

I noticed that under some circumstances "git log <range> -- <file>" will not show you all the commits in the range that affected that file. In particular if one of the commits removes the file, previous modifying commits are not shown.

I found this in the current linux-next tree (next-20080229).
git log stable.. -- arch/avr32/kernel/semaphore.c

will show the commit that removes this file, but not the commit that modifies it. So, is this a bug in git log or my understanding?

If you do "git log -p stable.." and search for the file name, you will find the other commit.

git version 1.5.4.3 from Debian unstable.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
Shawn O. Pearce· Mar 1, 2008, 03:05 UTC · re: Stephen Rothwell · lore

Re: Anomaly in git log?

Stephen Rothwell <sfr@canb.auug.org.au> wrote:
Show 14 quoted lines
> I noticed that under some circumstances "git log <range> -- <file>" will
> not show you all the commits in the range that affected that file.  In
> particular if one of the commits removes the file, previous modifying
> commits are not shown.
> 
> I found this in the current linux-next tree (next-20080229).
> 
> git log stable.. -- arch/avr32/kernel/semaphore.c
> 
> will show the commit that removes this file, but not the commit that
> modifies it.  So, is this a bug in git log or my understanding?
> 
> If you do "git log -p stable.." and search for the file name, you will
> find the other commit.

I have seen this happen on my own day-job repositories. What is most likely the case is the path got deleted on one side of a merge, but was modified on the history of the other side. Since the file is deleted in the merge the path limiter prunes the history and doesn't include search down the other side looking for the modify.

Try adding --full-history to your git-log command line. But even with that there are some cases where git-log prunes an interesting side branch when the path limiter is being used.

-- 
Shawn.

← back to recent threads