From: Jeff King <peff@peff.net>
To: Brian Norris <computersforpeace@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git-log: tracking deleted file in a repository with multiple "initial commit" histories
Date: Tue, 16 Feb 2016 15:45:57 -0500 [thread overview]
Message-ID: <20160216204557.GB27484@sigill.intra.peff.net> (raw)
In-Reply-To: <20160216202442.GH21465@google.com>
On Tue, Feb 16, 2016 at 12:24:42PM -0800, Brian Norris wrote:
> I'm not sure if this is a known behavior or a new bug report. I at least
> couldn't find anyone mentioning this exact problem.
>
> I'm using a git repository that has multiple "inital commits" (i.e., a
> few different directory trees were imported via svn-to-git as different
> branches) whose histories have been merged together to the single master
> branch, and the file I want to track is both added and removed in only
> one of those lineages. When I try to do:
>
> $ git log -- <file>
>
> on the deleted file in the master branch, I get no history. But if I
> checkout the particular sub-tree of the merge history, then git-log
> returns the appropriate history.
See the section on History Simplification in git-log. But basically,
when you specify a pathspec, git does not traverse side branches that
had no effect on the given pathspec.
So imagine we are walking backwards through history and showing each
commit, and we hit a merge where the content at that path is at some
sha1 X. We see on one side of the merge that the parent was also at X,
and on the other it was at Y. We do not bother following the commits
down the second parent at all. Perhaps it touched the file and perhaps
it did not, but it does not matter, as the merge threw away anything it
did in favor of the first parent.
Yours is a special case where the final result is "deleted". So there is
a merge where one side had already deleted it, and the other side had
some content, but the merge chose the deletion.
If you want to see the full history, you can with "--full-history"
(there are some other simplification possibilities, but I don't think
any of them are interesting for your particular case).
If you want to find the merge in question, something like:
git log --graph --full-history -m --oneline --raw -- init/iptables.conf
would work. In your case, it's probably:
8f4314b Move 'src/platform/init' to 'src/platform2'
-Peff
next prev parent reply other threads:[~2016-02-16 20:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 20:24 [BUG] git-log: tracking deleted file in a repository with multiple "initial commit" histories Brian Norris
2016-02-16 20:45 ` Jeff King [this message]
2016-02-16 21:24 ` Brian Norris
2016-02-16 22:29 ` Jeff King
2016-02-18 22:27 ` Brian Norris
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160216204557.GB27484@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=computersforpeace@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).