{"thread":{"id":"27634","subject":"git log --follow doesn't follow a rename over a merge","startedAt":"2011-06-15T22:41:50Z","lastAt":"2011-06-16T22:14:15Z","messageCount":14,"participants":["James Blackburn","Jakub Narebski","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"170097","messageId":"BANLkTimjEp0ntq80qttT9uZN2YGuhsnZBw@mail.gmail.com","threadId":"27634","inReplyTo":null,"subject":"git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-15T22:41:50Z","receivedAt":"2011-06-15T22:41:50Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"Hi All,\n\nI'm trying, without success, to get git log to show the history of a\nfile across a rename.  I'm using git version 1.7.5.4, and git blame\nhas no such issues tracking the source of the lines.\n\nThis is part of a CVS migration.  In the repo a number of directories\nwere committed atomically, but they originated from another CVS\nrepository.  During the migration, I've grafted the history from the\noriginating repository onto the destination repo's commit of the\ncontent.  Blame looks good, but log won't find the rename.\n\nGit blame attributes 3 files:\n> git blame dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpoints.java | awk '{print $2}' |sort |uniq\ndsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpoints.java\nplugins/org.eclipse.dd.dsf/src/org/eclipse/dd/dsf/debug/IBreakpoints.java\nplugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n\nGit log shows:\n> git log --oneline dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpoints.java\n70237c3 Bug 315439 Fix up copyright\n6a53ab4 [290074] - [services][breakpoints] IBreakpointDMData interface\nshould extend IDMData\n640102e partial fix for Bugzilla 265882\n5b47187 Migrated DSF and DSF-GDB to the CDT project.\n\nAnd it shows one fewer if I turn on --follow (with as many\ncombinations of -M -C as I've tried):\n> git log -M -C -C --follow  --oneline dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpoints.java\n70237c3 Bug 315439 Fix up copyright\n6a53ab4 [290074] - [services][breakpoints] IBreakpointDMData interface\nshould extend IDMData\n640102e partial fix for Bugzilla 265882\n\nMy new merge commit is 5b47187 (when the content first arrived in the repo):\n> git show 5b47187\ncommit 5b471873662a87a77cfd854c98fca9c9948aa878\nMerge: 4709306 c1e6da2\n...\n\nI can see the file in the parent of the merge:\n> git show c1e6da2:plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n...\nand the renamed file after the merge:\n> git show 5b47187:dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpoints.java\n...\n(Neither file exists on the 4709 side)\n\nInterestingly the tricks mentioned here\n(http://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo)\nfor working out where a file was removed, produce no output:\n> git log --follow --diff-filter=D --oneline -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n> git rev-list -n 1 HEAD -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.javaJB\n\nBut log does work for the file if follow is specified (output with\n--diff-filter is empty...):\n> git log --follow --oneline -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n10580b5 Updated copyright statements.\n17585c3 [218577] Cleaned up IBreakpoints interface.\n...\n\nHave I done something wrong in grafting history like this, or is this\njust a problem with the way git log --follow tracks renames?\n\nThe repo's here if anyone's interested (it's 85M...):\ngit://github.com/jamesblackburn/org.eclipse.cdt\n\nMany thanks for any insight.\nCheers,\nJames\n"},{"id":"170128","messageId":"m362o5vrhd.fsf@localhost.localdomain","threadId":"27634","inReplyTo":"BANLkTimjEp0ntq80qttT9uZN2YGuhsnZBw@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-06-16T13:25:19Z","receivedAt":"2011-06-16T13:25:19Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"James Blackburn <jamesblackburn@gmail.com> writes:\n\n> I'm trying, without success, to get git log to show the history of a\n> file across a rename.  I'm using git version 1.7.5.4, and git blame\n> has no such issues tracking the source of the lines.\n\n[...]\n\n> Have I done something wrong in grafting history like this, or is this\n> just a problem with the way git log --follow tracks renames?\n\nThe `--follow` option to git-log is more of a bolted-on hack rather\nthan proper solution, see 750f7b6 (Finally implement \"git log\n--follow\", 2007-06-19), and it might not work in all cases.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"170130","messageId":"BANLkTik1-UvEXqzgdXwcK3x6_o8fDiwB7g@mail.gmail.com","threadId":"27634","inReplyTo":"m362o5vrhd.fsf@localhost.localdomain","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T13:31:02Z","receivedAt":"2011-06-16T13:31:02Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"On 16 June 2011 14:25, Jakub Narebski <jnareb@gmail.com> wrote:\n> James Blackburn <jamesblackburn@gmail.com> writes:\n>\n>> I'm trying, without success, to get git log to show the history of a\n>> file across a rename.  I'm using git version 1.7.5.4, and git blame\n>> has no such issues tracking the source of the lines.\n>\n> [...]\n>\n>> Have I done something wrong in grafting history like this, or is this\n>> just a problem with the way git log --follow tracks renames?\n>\n> The `--follow` option to git-log is more of a bolted-on hack rather\n> than proper solution, see 750f7b6 (Finally implement \"git log\n> --follow\", 2007-06-19), and it might not work in all cases.\n\nThanks for the reply Jakub.\n\nI'm also interested in knowing what incantation I need to give to\nactually get history of the file which was previously removed.  e.g. I\nknow the full path:\n   plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\nused to exist, but without --follow, git log returns nothing.\n\nSimilarly I can't figure out how to find (without knowing in advance)\nwhich was the last commit which contained this version of\nIBreakpoints.java. i.e. which commit removed / renamed it?\n\nCheers,\nJames\n"},{"id":"170135","messageId":"BANLkTi=4S08h=uMV5oo7S9qpruMot2kVfg@mail.gmail.com","threadId":"27634","inReplyTo":"BANLkTik1-UvEXqzgdXwcK3x6_o8fDiwB7g@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T17:01:25Z","receivedAt":"2011-06-16T17:01:25Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"I see a lot of this has been discussed before... but just to add that\nJeff's blame-log.sh:\nhttp://git.661346.n2.nabble.com/alternate-log-follow-idea-td1385917.html\nseems to work and show the full history of the file past the rename+merge!\n\nI was also interested in whether there's a better way of re-connecting\nhistory than grafting one repository's history into the commit which\nmade it visible in another?  AFAICS the graft is no different to a\nmerge commit which contains a rename in the merged node, so I'm\nguessing this is a reasonable thing to do?\n\nCheers,\nJames\n"},{"id":"170136","messageId":"20110616173451.GB6584@sigill.intra.peff.net","threadId":"27634","inReplyTo":"BANLkTik1-UvEXqzgdXwcK3x6_o8fDiwB7g@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-16T17:34:51Z","receivedAt":"2011-06-16T17:34:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 16, 2011 at 02:31:02PM +0100, James Blackburn wrote:\n\n> I'm also interested in knowing what incantation I need to give to\n> actually get history of the file which was previously removed.  e.g. I\n> know the full path:\n>    plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n> used to exist, but without --follow, git log returns nothing.\n\nDoesn't:\n\n  git log -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n\ndo that?\n\n-Peff\n"},{"id":"170137","messageId":"20110616174554.GC6584@sigill.intra.peff.net","threadId":"27634","inReplyTo":"BANLkTi=4S08h=uMV5oo7S9qpruMot2kVfg@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-16T17:45:54Z","receivedAt":"2011-06-16T17:45:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 16, 2011 at 06:01:25PM +0100, James Blackburn wrote:\n\n> I see a lot of this has been discussed before... but just to add that\n> Jeff's blame-log.sh:\n> http://git.661346.n2.nabble.com/alternate-log-follow-idea-td1385917.html\n> seems to work and show the full history of the file past the rename+merge!\n\nYou may want to also check out the \"line-level history browser\" work by\nBo Yang and Thomas Rast, which is a similar idea, but done much better.\n\nYou can find it here:\n\n  http://repo.or.cz/w/git/trast.git/shortlog/refs/heads/line-log-cleanup\n\nor pull it with:\n\n  git pull git://repo.or.cz/git/trast.git line-log-cleanup\n\nUse on a whole file is something like:\n\n  git log -L '1,$':yourfile\n\nBut note that it is a work in progress, and I seem to be able to get it\nto segfault on some simple tests.\n\n> I was also interested in whether there's a better way of re-connecting\n> history than grafting one repository's history into the commit which\n> made it visible in another?  AFAICS the graft is no different to a\n> merge commit which contains a rename in the merged node, so I'm\n> guessing this is a reasonable thing to do?\n\nUsually you would graft the tip of the old history to the root commit of\nthe new history. So it's not a merge, but makes it look like a\ncontiguous linear history near the graft. But that's only a\nper-repository thing. If you want to join two histories in the actual\nhistory graph, you would merge them; if one supersedes the other, then\nyou would use the \"ours\" merge strategy to ignore the other side.\n\nI'm not 100% sure I understand your question. Does that answer make\nsense?\n\n-Peff\n"},{"id":"170139","messageId":"7vy611hd38.fsf@alter.siamese.dyndns.org","threadId":"27634","inReplyTo":"20110616173451.GB6584@sigill.intra.peff.net","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-16T17:59:23Z","receivedAt":"2011-06-16T17:59:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Jun 16, 2011 at 02:31:02PM +0100, James Blackburn wrote:\n>\n>> I'm also interested in knowing what incantation I need to give to\n>> actually get history of the file which was previously removed.  e.g. I\n>> know the full path:\n>>    plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n>> used to exist, but without --follow, git log returns nothing.\n>\n> Doesn't:\n>\n>   git log -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n>\n> do that?\n\nIf the file emerged in one branch (either the primary or a side branch) in\nthe past as a failed experiment and then got removed before merging back,\ni.e.\n\n   past ---o----o-----o-----o-----o-----o-----o-----o--- now\n            \\                          /\n             o----*----o----o----*----o\n                  ^added         ^removed\n\nthen the merges are simplified away and you would not see it.\n\nPerhaps simplify-merges option may help.\n"},{"id":"170142","messageId":"20110616181509.GA12689@sigill.intra.peff.net","threadId":"27634","inReplyTo":"7vy611hd38.fsf@alter.siamese.dyndns.org","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-16T18:15:09Z","receivedAt":"2011-06-16T18:15:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 16, 2011 at 10:59:23AM -0700, Junio C Hamano wrote:\n\n> > Doesn't:\n> >\n> >   git log -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n> >\n> > do that?\n> \n> If the file emerged in one branch (either the primary or a side branch) in\n> the past as a failed experiment and then got removed before merging back,\n> i.e.\n> \n>    past ---o----o-----o-----o-----o-----o-----o-----o--- now\n>             \\                          /\n>              o----*----o----o----*----o\n>                   ^added         ^removed\n> \n> then the merges are simplified away and you would not see it.\n\nAh, right. The default simplification so often does what I want that I\nforget there are cases it can miss.\n\n> Perhaps simplify-merges option may help.\n\nThis test case shows full-history helping:\n\n-- >8 --\ncommit() {\n  echo $1 >$1 && git add $1 && git commit -m $1\n}\n\ngit init repo &&\ncd repo &&\ncommit one &&\ncommit two &&\ncommit three &&\ngit checkout -b side HEAD^ &&\ncommit four &&\ncommit five &&\ngit rm five && git commit -m \"remove five\" &&\ncommit six &&\ngit checkout master &&\ngit merge side &&\necho \"==> default log (shows nothing)\" &&\ngit --no-pager log -- five\necho \"==> full-history\" &&\ngit --no-pager log --full-history -- five\n"},{"id":"170143","messageId":"BANLkTimmKnzD7LTApxzw5oTpvLU7oM0yjw@mail.gmail.com","threadId":"27634","inReplyTo":"20110616173451.GB6584@sigill.intra.peff.net","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T18:21:33Z","receivedAt":"2011-06-16T18:21:33Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"> Doesn't:\n>  git log -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n> do that?\n\nUnfortunately that returuns no output.\n\nIf I add --follow, I get history:\ngit log --follow --oneline --\nplugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n10580b5 Updated copyright statements.\n...\n\nWhere 10580 is a distant parent of c1e6da which was merged in to 5b47187.\n\nOn 16 June 2011 18:45, Jeff King <peff@peff.net> wrote:\n> Usually you would graft the tip of the old history to the root commit of\n> the new history. So it's not a merge, but makes it look like a\n> contiguous linear history near the graft. But that's only a\n> per-repository thing. If you want to join two histories in the actual\n> history graph, you would merge them; if one supersedes the other, then\n> you would use the \"ours\" merge strategy to ignore the other side.\n\nIn this case the commit is a 'merge' commit as history looks like:\n\n  2002 ---o----o-----o-----o-----X-----o-----o-----o--- 2011         (CDT)\n                                     /\n  2006 ---o----o-----o-----o--   (2009)                                  (DSF)\n\nCDT has existed since 2002. In 2006, at X, DSF was committed onto HEAD\nof  CDT.  Basically wholesale apart from the path (Java package)\nchange (+some minor changes to 'import's).\n\nSo I created a graft from the commit which made it appear from CDT\nonto the HEAD of a DSF as it was when the import happened.  Which\nmakes X have two parents.\n\nCheers,\nJames\n"},{"id":"170146","messageId":"BANLkTikMNYyV40XM26rc6Ov6ZYO643mukA@mail.gmail.com","threadId":"27634","inReplyTo":"7vy611hd38.fsf@alter.siamese.dyndns.org","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T18:41:14Z","receivedAt":"2011-06-16T18:41:14Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"On 16 June 2011 18:59, Junio C Hamano <gitster@pobox.com> wrote:\n>   past ---o----o-----o-----o-----o-----o-----o-----o--- now\n>            \\                          /\n>             o----*----o----o----*----o\n>                  ^added         ^removed\n>\n> then the merges are simplified away and you would not see it.\n>\n> Perhaps simplify-merges option may help.\n\nMagic, that works!\n\nWhat I don't get is that I believe the file is removed in the 'merge'\ncommit 'X', which is reachable from master, not in the feature branch:\n\n 2002 ---o----o-----o-----o-----X-----o-----o-----o--- 2011         (CDT)\n                                    /\n 2006 ---o----o-----o-----o--   (2009)                                  (DSF)\n\n> git log --simplify-merges --oneline -- plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\n2f1c904 [memory] DSDP-DD -> CDT initial commit\n5b47187 Migrated DSF and DSF-GDB to the CDT project.\n10580b5 Updated copyright statements.\n...\n\nSo 5b48718 is X, and the file exists in the DSF parent of X: c1e6da2\n\nI think 2f1c904 is entirely wrong too -- it's another graft I've done,\nto a different repo, which isn't to do with DSF, and doesn't contain\nIBreakpoints.java:\n > git show 2f1c904:plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java\nfatal: Path 'plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IBreakpoints.java'\ndoes not exist in '2f1c904'\n\nGiven the file was removed during my 'merge' graft in commit X,\nshouldn't it be visible  in log without --simplify-merges?\n\nCheers,\nJames\n"},{"id":"170151","messageId":"7vlix1h8lz.fsf@alter.siamese.dyndns.org","threadId":"27634","inReplyTo":"BANLkTikMNYyV40XM26rc6Ov6ZYO643mukA@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-16T19:36:08Z","receivedAt":"2011-06-16T19:36:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"James Blackburn <jamesblackburn@gmail.com> writes:\n\n> Given the file was removed during my 'merge' graft in commit X,\n> shouldn't it be visible  in log without --simplify-merges?\n\nThe merge simplification logic does not treat earlier parent commits any\ndifferently than later parent commits of a merge (except when two parents\nare the same with respect to a given pathspec, and if the logic needs to\npick only one, the earlier parent will be picked), and that is by design.\n\nSo the short answer is no.\n"},{"id":"170152","messageId":"BANLkTin19sx9_+VKwD5TSxxJjHMZT-JoYQ@mail.gmail.com","threadId":"27634","inReplyTo":"20110616181509.GA12689@sigill.intra.peff.net","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T19:41:14Z","receivedAt":"2011-06-16T19:41:14Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"On 16 June 2011 19:15, Jeff King <peff@peff.net> wrote:\n> This test case shows full-history helping:\n\nThis test shows what I've done:\n\ncommit() {\n echo $1 >>$1 && git add $1 && git commit -m $1\n}\n\ngit init repo\ncd repo\ncommit one\ncommit two\ncommit three\n\ngit symbolic-ref HEAD refs/heads/newroot\nrm *\ngit rm --cached *\ncommit four\ncommit four\ncommit four\ncommit four\ncommit four\ncommit four\ncommit five\n\ngit checkout master\ngit merge --no-commit newroot\n\ngit mv four four2\ncommit six\ncommit four2\ncommit five\n\ngit log --graph --oneline\n* 7c4c441 five\n* 02a7262 four2\n*   6ac2fe0 six\n|\\\n| * d4f5e35 five\n| * 350d3e9 four\n| * b975d48 four\n| * 3bdbf38 four\n| * 5b58da8 four\n| * 9fb4f59 four\n| * a6d1492 four\n* b301c9c three\n* 38865e2 two\n* 9a9c689 one\n\nAt this point, only git-blame seems correct:\n> git blame -- four2\nCorrect\n\n> git log --oneline -- four2\n02a7262 four2\n6ac2fe0 six\n> git log --follow --oneline -- four2\n02a7262 four2\n\n>From the above: I can't log past four2 (without using  blame-log.sh).\n\n> git log -- four\n <no output>\n> git log --follow --oneline -- four\n350d3e9 four\nb975d48 four\n3bdbf38 four\n5b58da8 four\n9fb4f59 four\na6d1492 four\n\n>From above: I can't log four without doing '--follow', and the output\nis missing the deletion in the merge commit.\n\nLog of 'five', which hasn't been renamed, looks ok.\n\nJames\n"},{"id":"170164","messageId":"BANLkTi=7yFdkNgvGX38JM_GbS7=tqf=1sQ@mail.gmail.com","threadId":"27634","inReplyTo":"7vlix1h8lz.fsf@alter.siamese.dyndns.org","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T21:29:36Z","receivedAt":"2011-06-16T21:29:36Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"On 16 June 2011 20:36, Junio C Hamano <gitster@pobox.com> wrote:\n> James Blackburn <jamesblackburn@gmail.com> writes:\n>\n>> Given the file was removed during my 'merge' graft in commit X,\n>> shouldn't it be visible  in log without --simplify-merges?\n>\n> The merge simplification logic does not treat earlier parent commits any\n> differently than later parent commits of a merge (except when two parents\n> are the same with respect to a given pathspec, and if the logic needs to\n> pick only one, the earlier parent will be picked), and that is by design.\n>\n> So the short answer is no.\n\nI think this is quite tough to grok.  Git blame shows me a path, and\ngit log -- <path> returns no output in the simple example I gave.\n\nIn this case --simplify-merges gives me a complete log for the path,\nbut man git-log tells me it should do the opposite:\n       --simplify-merges\n           Additional option to --full-history to remove some needless\nmerges from the resulting history, as there are\n           no selected commits contributing to this merge.\n\nI'm not sure how I would have figured out this switch might be just\nthe trick to show the commits that touched this path, without your\ninput.\n\nAs a naive user I expected:\n  git log -- four\nto tell we which commits changed the path 'four'. Especially those\ncommits which are reachable from my current HEAD.  I don't really\nunderstand why one branch of history is worth following over another,\nespecially as the branch chosen, the older one, doesn't contain 'four'\nat all.\n\nCheers,\nJames\n"},{"id":"170168","messageId":"BANLkTi=S6B6n717CkcGcrek9r4RQ4wzwtA@mail.gmail.com","threadId":"27634","inReplyTo":"BANLkTikMNYyV40XM26rc6Ov6ZYO643mukA@mail.gmail.com","subject":"Re: git log --follow doesn't follow a rename over a merge","fromName":"James Blackburn","fromEmail":"jamesblackburn@gmail.com","sentAt":"2011-06-16T22:14:15Z","receivedAt":"2011-06-16T22:14:15Z","isPatch":false,"sender":{"key":"jamesblackburn@gmail.com","avatar":"https://gravatar.com/avatar/dacd1de956aceccae413b86cfb42fa952deb80631f85c4be6da4093e37416479?d=mp&s=160"},"body":"On 16 June 2011 19:41, James Blackburn <jamesblackburn@gmail.com> wrote:\n> I think 2f1c904 is entirely wrong too -- it's another graft I've done,\n> to a different repo, which isn't to do with DSF, and doesn't contain\n> IBreakpoints.java:\n\nThis looks like a bug?   man git-log:\n       [--] <path>...\n           Show only commits that affect any of the specified paths.\nTo prevent confusion with options and branch names,\n           paths may need to be prefixed with \"-- \" to separate them\nfrom options or refnames.\n\ngit log --graph --oneline\n* 6530823 six2\n*   05512d0 nine\n|\\\n| * 9917e1c seven\n| * 76a230e six\n| * a6d7961 six\n* f7f43f9 four2\n*   94392ac eight\n|\\\n| * 5cf0b04 five\n| * 5183657 four\n* bd329af three\n* 57aafee two\n* 3d9ecdf one\n\ngit log --simplify-merges --oneline -- four\n05512d0 nine\n94392ac eight\n5183657 four\n\nbut the merge commit at 'nine' has nothing to do with that path 'four'.\n\n\nReproduction steps:\n\ncommit() {\n echo $1 >>$1 && git add $1 && git commit -m $1\n}\n\ngit init repo\ncd repo\ncommit one\ncommit two\ncommit three\n\ngit symbolic-ref HEAD refs/heads/newroot\nrm *\ngit rm --cached *\ncommit four\ncommit five\n\ngit symbolic-ref HEAD refs/heads/newnewroot\nrm *\ngit rm --cached *\ncommit six\ncommit six\ncommit seven\n\ngit checkout master\ngit merge --no-commit newroot\n\ngit mv four four2\ncommit eight\ncommit four2\n\ngit merge --no-commit newnewroot\n\ngit mv six six2\ncommit nine\ncommit six2\n"}]}