{"thread":{"id":"17456","subject":"Git log can not show history before rename","startedAt":"2009-01-30T11:23:20Z","lastAt":"2009-01-31T07:04:18Z","messageCount":9,"participants":["Frank Li","Santi Béjar","Jakub Narebski","Linus Torvalds","Thomas Rast","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102571","messageId":"1976ea660901300323n384d3650s3bb5a575accb65d1@mail.gmail.com","threadId":"17456","inReplyTo":null,"subject":"Git log can not show history before rename","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2009-01-30T11:23:20Z","receivedAt":"2009-01-30T11:23:20Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":"mkdir tt3\ncd tt3\ngit init-db\ntouch a.c\ngit add a.c\ngit commit -a -m \"test1\"\n\ngit mv a.c b.c\ngit commit -a -m \"rename\"\n\nmodify b.c\ngit commit -a -m \"test2\"\n\ngit log -C -M -- b.c\n========================================\ncommit 8d55ed63d2048d41bde8c34dafc52c6a965d61ed\nAuthor: Frank Li <lznuaa@gmail.com>\nDate:   Fri Jan 30 19:20:10 2009 +0800\n    test2\ncommit af0214f7d32cf97fda2743e7d906305e6de2e9a2\nAuthor: Frank Li <lznuaa@gmail.com>\nDate:   Fri Jan 30 19:19:15 2009 +0800\n    rename\n=========================================\n\nI can't get history before rename.\n"},{"id":"102572","messageId":"adf1fd3d0901300329y53e46d91xda75799ce1244ddd@mail.gmail.com","threadId":"17456","inReplyTo":"1976ea660901300323n384d3650s3bb5a575accb65d1@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-01-30T11:29:47Z","receivedAt":"2009-01-30T11:29:47Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/1/30 Frank Li <lznuaa@gmail.com>:\n> mkdir tt3\n> cd tt3\n> git init-db\n\n\"git init\"\n\n> touch a.c\n> git add a.c\n> git commit -a -m \"test1\"\n>\n> git mv a.c b.c\n> git commit -a -m \"rename\"\n>\n> modify b.c\n> git commit -a -m \"test2\"\n>\n> git log -C -M -- b.c\n[...]\n> I can't get history before rename.\n\nYou asked to restrict the search to the b.c path.\n\nYou want:\n\ngit log --follow -- b.c\n\nMan git-log:\n       --follow\n           Continue listing the history of a file beyond renames.\n\nHTH,\nSanti\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"102575","messageId":"m33af1x9od.fsf@localhost.localdomain","threadId":"17456","inReplyTo":"adf1fd3d0901300329y53e46d91xda75799ce1244ddd@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-30T12:25:43Z","receivedAt":"2009-01-30T12:25:43Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n> 2009/1/30 Frank Li <lznuaa@gmail.com>:\n\n> > mkdir tt3\n> > cd tt3\n> > git init-db\n> \n> \"git init\"\n> \n> > touch a.c\n> > git add a.c\n> > git commit -a -m \"test1\"\n> >\n> > git mv a.c b.c\n> > git commit -a -m \"rename\"\n> >\n> > modify b.c\n> > git commit -a -m \"test2\"\n> >\n> > git log -C -M -- b.c\n> [...]\n> > I can't get history before rename.\n> \n> You asked to restrict the search to the b.c path.\n> \n> You want:\n> \n> git log --follow -- b.c\n> \n> Man git-log:\n>        --follow\n>            Continue listing the history of a file beyond renames.\n\nOr use\n\n  $ git log -C -- b.c a.c\n\n(you don't need '-M' option, as '-C' is superset of it).\n\nNote that '--follow' works for simple histories, but (as it is quite\nnew invention) doesn't work yet for all cases, like for example\nsubtree merge or equivalent.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"102576","messageId":"1976ea660901300429i6d9b3594m91222314c284d184@mail.gmail.com","threadId":"17456","inReplyTo":"adf1fd3d0901300329y53e46d91xda75799ce1244ddd@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2009-01-30T12:29:28Z","receivedAt":"2009-01-30T12:29:28Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":"Does it conflict with --parents?\nWhen I use --follow and --parents together,  parents can't rewrite.\nwithout --follow, parent can rewrite.\n\n\n2009/1/30 Santi Béjar <santi@agolina.net>:\n> 2009/1/30 Frank Li <lznuaa@gmail.com>:\n>> mkdir tt3\n>> cd tt3\n>> git init-db\n>\n> \"git init\"\n>\n>> touch a.c\n>> git add a.c\n>> git commit -a -m \"test1\"\n>>\n>> git mv a.c b.c\n>> git commit -a -m \"rename\"\n>>\n>> modify b.c\n>> git commit -a -m \"test2\"\n>>\n>> git log -C -M -- b.c\n> [...]\n>> I can't get history before rename.\n>\n> You asked to restrict the search to the b.c path.\n>\n> You want:\n>\n> git log --follow -- b.c\n>\n> Man git-log:\n>       --follow\n>           Continue listing the history of a file beyond renames.\n>\n> HTH,\n> Santi\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n>\n"},{"id":"102578","messageId":"adf1fd3d0901300449x7f6a2f5bq920068b46994c92e@mail.gmail.com","threadId":"17456","inReplyTo":"1976ea660901300429i6d9b3594m91222314c284d184@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-01-30T12:49:34Z","receivedAt":"2009-01-30T12:49:34Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"[Please, don't top post, and quote only what you are replying to]\n\n2009/1/30 Frank Li <lznuaa@gmail.com>:\n> Does it conflict with --parents?\n> When I use --follow and --parents together,  parents can't rewrite.\n> without --follow, parent can rewrite.\n\nI think there are no obvious reasons to conflict and they could work\ntogether, but as Jakub just said, --follow is quite new and only works\nwell with simple history and simple cases.\n\nSanti\n"},{"id":"102628","messageId":"alpine.LFD.2.00.0901300910580.3150@localhost.localdomain","threadId":"17456","inReplyTo":"1976ea660901300429i6d9b3594m91222314c284d184@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-01-30T17:17:00Z","receivedAt":"2009-01-30T17:17:00Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 30 Jan 2009, Frank Li wrote:\n>\n> Does it conflict with --parents?\n\nYes. --follow and --parents do not play well together.\n\nThat's simply because --follow is a total hack, meant to just satisfy \nex-SVN users who never knew anything about things like parenthood or nice \nrevision graphs anyway.\n\nIt's not totally fundamental, but the current implementation of \"--follow\" \nis really a quick preprocessing thing bolted onto the revision walking \nlogic, rather than beign anything really integral.\n\nIf you want --follow to really work together with --parents (and to do the \nright thing wrt merges etc - different renames coming in through different \nbranches), you'd really have to rewrite the whole --follow logic.\n\nOne approach is to use --follow as the quick hack it is - and then when \nyou see \"oh, file X was renamed from file Y\", and you want to see the nice \nfull history, you go back to the native git model (which is not --follow), \nwhich is based on pathname pattherns, and then do\n\n\tgitk -- X Y\n\nto see the history of _both_ names, and now the rename will show up \nproperly (and now you'll get proper parenthood because you're no longer \nusing the hackish --follow thing).\n\nIf somebody wants to do a more intelligent --follow, I can only applaud, \nbut I'm personally not likely to look into it.\n\n\t\t\tLinus\n"},{"id":"102629","messageId":"alpine.LFD.2.00.0901300918010.3150@localhost.localdomain","threadId":"17456","inReplyTo":"alpine.LFD.2.00.0901300910580.3150@localhost.localdomain","subject":"Re: Git log can not show history before rename","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-01-30T17:23:38Z","receivedAt":"2009-01-30T17:23:38Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 30 Jan 2009, Linus Torvalds wrote:\n> \n> If somebody wants to do a more intelligent --follow, I can only applaud, \n> but I'm personally not likely to look into it.\n\nSide note: you can probably get a _limited_ form of parent rewriting on \ntop of --follow by adding some more hacks. IOW, I think you can make \n--parents --follow work better in practice even with the hacky thing by \nadding some more hacks on top. But you'll never get the _true_ answer (ie \nget things right across renames in different branches) without totally \nripping out the current --follow logic.\n\nInterestingly, I suspect that doing --follow \"right\" is really quite \ncomplicated, but one sign of doing it right would be to allow multiple \nfiles to be tracked at the same time.\n\nBecause in a \"correct\" implementation of --follow you'd literally have to \nattach different filenames to different commits (rather than have one \nglobal filename that you follow and then switch for everybody when you see \na rename), and also have the ability to track multiple files per commit \nwhen you reach the same commit under two filenames.\n\nI really never wanted the pain, and never cared enough for it, which is \nwhy --follow is such a hack. It literally was designed as a \"SVN noob\" \npleaser, not as a \"real git functionality\" thing. The idea was that you'd \nget away from the (broken) mindset of thinking that renames matter in the \nbig picture.\n\n\t\t\tLinus\n"},{"id":"102649","messageId":"200901302252.18051.trast@student.ethz.ch","threadId":"17456","inReplyTo":"adf1fd3d0901300449x7f6a2f5bq920068b46994c92e@mail.gmail.com","subject":"Re: Git log can not show history before rename","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-01-30T21:52:13Z","receivedAt":"2009-01-30T21:52:13Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Santi Béjar wrote:\n> 2009/1/30 Frank Li <lznuaa@gmail.com>:\n> > Does it conflict with --parents?\n> > When I use --follow and --parents together,  parents can't rewrite.\n> > without --follow, parent can rewrite.\n> \n> I think there are no obvious reasons to conflict and they could work\n> together, but as Jakub just said, --follow is quite new and only works\n> well with simple history and simple cases.\n\nYou might find this useful:\n\n  $ git config alias.renames\n  !GIT_PAGER=\"grep -v '^$' | sort -u\" git --paginate log --follow --name-only --pretty=format:\"\" --\n\nSlow and hacky, but works nice enough in practice.  The intended use\ncase is like\n\n  $ gitk --complicated-rev-options $(git renames git-svn.perl)\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"102681","messageId":"20090131070418.GB3033@coredump.intra.peff.net","threadId":"17456","inReplyTo":"200901302252.18051.trast@student.ethz.ch","subject":"Re: Git log can not show history before rename","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-31T07:04:18Z","receivedAt":"2009-01-31T07:04:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 30, 2009 at 10:52:13PM +0100, Thomas Rast wrote:\n\n> You might find this useful:\n> \n>   $ git config alias.renames\n>   !GIT_PAGER=\"grep -v '^$' | sort -u\" git --paginate log --follow --name-only --pretty=format:\"\" --\n> \n> Slow and hacky, but works nice enough in practice.  The intended use\n> case is like\n> \n>   $ gitk --complicated-rev-options $(git renames git-svn.perl)\n\nRelated (but also slow and hacky :) ), it is sometimes nice to see not\nthe whole history of a file, but all of the commits, in the usual log\norder, that ended up affecting the outcome of a set of content (so not\nany commits whose work was later overwritten). I posted a short script\nfor it a while back:\n\n  http://article.gmane.org/gmane.comp.version-control.git/99278\n\n-Peff\n"}]}