{"thread":{"id":"22477","subject":"A git-mv question","startedAt":"2010-02-02T00:08:38Z","lastAt":"2010-02-02T15:32:45Z","messageCount":5,"participants":["Ron Garret","Nicolas Pitre","Junio C Hamano","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"133299","messageId":"ron1-09EE6C.16083801022010@news.gmane.org","threadId":"22477","inReplyTo":null,"subject":"A git-mv question","fromName":"Ron Garret","fromEmail":"ron1@flownet.com","sentAt":"2010-02-02T00:08:38Z","receivedAt":"2010-02-02T00:08:38Z","isPatch":false,"sender":{"key":"ron1@flownet.com","avatar":null},"body":"If I do a git-mv *and* edit the file all in one commit, does that get \nrecorded in a way that allows git to track the change through the \nchanged file name?  In other words, if I do just a git-mv (without \nchanging the file) git can track that by observing that two differently \nnamed objects in two different commit trees contain the same blob.  But \nif the file is edited then the blobs will be different.  Is git smart \nenough to distinguish a git-mv and edit from, say, the equivalent git-rm \nand git-add?  If so, how does it do it?\n\nThanks,\nrg\n"},{"id":"133303","messageId":"alpine.LFD.2.00.1002011927490.1681@xanadu.home","threadId":"22477","inReplyTo":"ron1-09EE6C.16083801022010@news.gmane.org","subject":"Re: A git-mv question","fromName":"Nicolas Pitre","fromEmail":"nico@fluxnic.net","sentAt":"2010-02-02T00:29:26Z","receivedAt":"2010-02-02T00:29:26Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Mon, 1 Feb 2010, Ron Garret wrote:\n\n> If I do a git-mv *and* edit the file all in one commit, does that get \n> recorded in a way that allows git to track the change through the \n> changed file name?  In other words, if I do just a git-mv (without \n> changing the file) git can track that by observing that two differently \n> named objects in two different commit trees contain the same blob.  But \n> if the file is edited then the blobs will be different.  Is git smart \n> enough to distinguish a git-mv and edit from, say, the equivalent git-rm \n> and git-add?  If so, how does it do it?\n\nPlease see:\n\nhttp://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html\n\n\nNicolas\n"},{"id":"133305","messageId":"7vwrywmpmd.fsf@alter.siamese.dyndns.org","threadId":"22477","inReplyTo":"alpine.LFD.2.00.1002011927490.1681@xanadu.home","subject":"Re: A git-mv question","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-02T00:46:02Z","receivedAt":"2010-02-02T00:46:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@fluxnic.net> writes:\n\n> Please see:\n>\n> http://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html\n\nThanks.\n\nProbably it needs a bit of updates to help new people read it.\n\n * It talks about diff-* family.  They exist, but what they do can be\n   triggered also by \"diff\" wrapper and that is the primary way the users\n   know about \"diff\" these days.\n\n * Because it was written to illustrate the low-level diff-* family, it\n   says \"when they are run without -p option\".  People who only know\n   Porcelain \"diff\" need to read as if it said \"when run with --raw\".\n\n * It does not talk about \"log -p\" but the discussion applies there as\n   well (log is a glorified form of diff-tree).\n"},{"id":"133326","messageId":"ron1-C9CA44.23215801022010@news.gmane.org","threadId":"22477","inReplyTo":"alpine.LFD.2.00.1002011927490.1681@xanadu.home","subject":"Re: A git-mv question","fromName":"Ron Garret","fromEmail":"ron1@flownet.com","sentAt":"2010-02-02T07:21:58Z","receivedAt":"2010-02-02T07:21:58Z","isPatch":false,"sender":{"key":"ron1@flownet.com","avatar":null},"body":"In article <alpine.LFD.2.00.1002011927490.1681@xanadu.home>,\n Nicolas Pitre <nico@fluxnic.net> wrote:\n\n> On Mon, 1 Feb 2010, Ron Garret wrote:\n> \n> > If I do a git-mv *and* edit the file all in one commit, does that get \n> > recorded in a way that allows git to track the change through the \n> > changed file name?  In other words, if I do just a git-mv (without \n> > changing the file) git can track that by observing that two differently \n> > named objects in two different commit trees contain the same blob.  But \n> > if the file is edited then the blobs will be different.  Is git smart \n> > enough to distinguish a git-mv and edit from, say, the equivalent git-rm \n> > and git-add?  If so, how does it do it?\n> \n> Please see:\n> \n> http://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html\n> \n\nThanks!  A little light reading :-)\n\nrg\n"},{"id":"133362","messageId":"m3r5p3ac2e.fsf@localhost.localdomain","threadId":"22477","inReplyTo":"ron1-09EE6C.16083801022010@news.gmane.org","subject":"Re: A git-mv question","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-02-02T15:32:45Z","receivedAt":"2010-02-02T15:32:45Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ron Garret <ron1@flownet.com> writes:\n\n> If I do a git-mv *and* edit the file all in one commit, does that get \n> recorded in a way that allows git to track the change through the \n> changed file name?  In other words, if I do just a git-mv (without \n> changing the file) git can track that by observing that two differently \n> named objects in two different commit trees contain the same blob.  But \n> if the file is edited then the blobs will be different.  Is git smart \n> enough to distinguish a git-mv and edit from, say, the equivalent git-rm \n> and git-add?  If so, how does it do it?\n\nGit does not distinguish between git-mv and equivalent git-rm+git-add;\nit employs heuristic similarity based (based on how contents of files\nis similar to each other) rename detection.\n\nAlso worth noting is that git does consider only endpoints for rename\ndetection in diff and in merge; it does not check history if there\nwere clean rename / rename + edit.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}