All of lore.kernel.org
 help / color / mirror / Atom feed
* A git-mv question
@ 2010-02-02  0:08 Ron Garret
  2010-02-02  0:29 ` Nicolas Pitre
  2010-02-02 15:32 ` Jakub Narebski
  0 siblings, 2 replies; 5+ messages in thread
From: Ron Garret @ 2010-02-02  0:08 UTC (permalink / raw)
  To: git

If I do a git-mv *and* edit the file all in one commit, does that get 
recorded in a way that allows git to track the change through the 
changed file name?  In other words, if I do just a git-mv (without 
changing the file) git can track that by observing that two differently 
named objects in two different commit trees contain the same blob.  But 
if the file is edited then the blobs will be different.  Is git smart 
enough to distinguish a git-mv and edit from, say, the equivalent git-rm 
and git-add?  If so, how does it do it?

Thanks,
rg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A git-mv question
  2010-02-02  0:08 A git-mv question Ron Garret
@ 2010-02-02  0:29 ` Nicolas Pitre
  2010-02-02  0:46   ` Junio C Hamano
  2010-02-02  7:21   ` Ron Garret
  2010-02-02 15:32 ` Jakub Narebski
  1 sibling, 2 replies; 5+ messages in thread
From: Nicolas Pitre @ 2010-02-02  0:29 UTC (permalink / raw)
  To: Ron Garret; +Cc: git

On Mon, 1 Feb 2010, Ron Garret wrote:

> If I do a git-mv *and* edit the file all in one commit, does that get 
> recorded in a way that allows git to track the change through the 
> changed file name?  In other words, if I do just a git-mv (without 
> changing the file) git can track that by observing that two differently 
> named objects in two different commit trees contain the same blob.  But 
> if the file is edited then the blobs will be different.  Is git smart 
> enough to distinguish a git-mv and edit from, say, the equivalent git-rm 
> and git-add?  If so, how does it do it?

Please see:

http://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html


Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A git-mv question
  2010-02-02  0:29 ` Nicolas Pitre
@ 2010-02-02  0:46   ` Junio C Hamano
  2010-02-02  7:21   ` Ron Garret
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2010-02-02  0:46 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Ron Garret, git

Nicolas Pitre <nico@fluxnic.net> writes:

> Please see:
>
> http://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html

Thanks.

Probably it needs a bit of updates to help new people read it.

 * It talks about diff-* family.  They exist, but what they do can be
   triggered also by "diff" wrapper and that is the primary way the users
   know about "diff" these days.

 * Because it was written to illustrate the low-level diff-* family, it
   says "when they are run without -p option".  People who only know
   Porcelain "diff" need to read as if it said "when run with --raw".

 * It does not talk about "log -p" but the discussion applies there as
   well (log is a glorified form of diff-tree).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A git-mv question
  2010-02-02  0:29 ` Nicolas Pitre
  2010-02-02  0:46   ` Junio C Hamano
@ 2010-02-02  7:21   ` Ron Garret
  1 sibling, 0 replies; 5+ messages in thread
From: Ron Garret @ 2010-02-02  7:21 UTC (permalink / raw)
  To: git

In article <alpine.LFD.2.00.1002011927490.1681@xanadu.home>,
 Nicolas Pitre <nico@fluxnic.net> wrote:

> On Mon, 1 Feb 2010, Ron Garret wrote:
> 
> > If I do a git-mv *and* edit the file all in one commit, does that get 
> > recorded in a way that allows git to track the change through the 
> > changed file name?  In other words, if I do just a git-mv (without 
> > changing the file) git can track that by observing that two differently 
> > named objects in two different commit trees contain the same blob.  But 
> > if the file is edited then the blobs will be different.  Is git smart 
> > enough to distinguish a git-mv and edit from, say, the equivalent git-rm 
> > and git-add?  If so, how does it do it?
> 
> Please see:
> 
> http://www.kernel.org/pub/software/scm/git/docs/gitdiffcore.html
> 

Thanks!  A little light reading :-)

rg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A git-mv question
  2010-02-02  0:08 A git-mv question Ron Garret
  2010-02-02  0:29 ` Nicolas Pitre
@ 2010-02-02 15:32 ` Jakub Narebski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2010-02-02 15:32 UTC (permalink / raw)
  To: Ron Garret; +Cc: git

Ron Garret <ron1@flownet.com> writes:

> If I do a git-mv *and* edit the file all in one commit, does that get 
> recorded in a way that allows git to track the change through the 
> changed file name?  In other words, if I do just a git-mv (without 
> changing the file) git can track that by observing that two differently 
> named objects in two different commit trees contain the same blob.  But 
> if the file is edited then the blobs will be different.  Is git smart 
> enough to distinguish a git-mv and edit from, say, the equivalent git-rm 
> and git-add?  If so, how does it do it?

Git does not distinguish between git-mv and equivalent git-rm+git-add;
it employs heuristic similarity based (based on how contents of files
is similar to each other) rename detection.

Also worth noting is that git does consider only endpoints for rename
detection in diff and in merge; it does not check history if there
were clean rename / rename + edit.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-02 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02  0:08 A git-mv question Ron Garret
2010-02-02  0:29 ` Nicolas Pitre
2010-02-02  0:46   ` Junio C Hamano
2010-02-02  7:21   ` Ron Garret
2010-02-02 15:32 ` Jakub Narebski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.