git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] Introduce rename factorization in diffcore.

From
Yann Dirson <ydirson@altern.org>
Date
Nov 8, 2008, 00:29 UTC
Message-ID
<20081108002952.GC4030@nan92-1-81-57-214-146.fbx.proxad.net>
In-Reply-To
<7vhc6jdrvs.fsf@gitster.siamese.dyndns.org>
On Fri, Nov 07, 2008 at 03:43:19PM -0800, Junio C Hamano wrote:
Show 21 quoted lines
> Yann Dirson <ydirson@altern.org> writes:
> 
> > I hope I just miss your point.  Letting unaware tools handle such a
> > patch "the right way" would imply just adding the information "dir foo
> > moved to bar", and not removing the individual file moves, which goes
> > in the way of the exact reason why I have started to work on this.
> 
> If your change is to move a/{1,2,3} to b/{1,2,3} and without content
> change to a/{1,2} to b/{1,2}, then do you want to say "a/ moved to b/
> and by the way here is the content change from a/3 to b/3" without saying
> anything about a/{1,2} and b/{1,2}?
> 
> Two points.
> 
>  * I do not think it is a good idea to begin with.  If you are to apply
>    such a patch (with git-apply that is updated with your patch to
>    understand that notation) to the exact tree that has only {1,2,3} under
>    a/, you would get an expected result.  But if the recipient of your
>    patch has a/4 (or lacks a/2), there is no cue in the patch that
>    automatically moving a/4 to b/4 may or may not be what is sane (or the
>    patch is unapplicable in general).

Sure in theory. But in practice I do not remember one time when, if all files from one dir are moved in one branch, the files added on another in the same dir were not bound to be moved as well.

Anway, if we feel git-apply should not decide without the user knowing, we can make it refuse by default, with options to do either way, and one option to ask for each doubtful file instead.

Show 5 quoted lines
>  * If you give at least the names of paths that were moved without any
>    content changes as I suggested, at least the recipient of your patch
>    can catch the case where his tree is structurally different from what
>    you used to prepare the patch for by noticing the a/2 in the patch that
>    he does not have.
Right.
> In addition, if you keep the movements for the paths whose contents did
> not change, existing tools are perfectly capable of applying (or showing)
> the output.  I seriously doubt that keeping 4 lines per perfectly moved
> paths is too much a price to pay to keep backward compatibility.

OK, so I realize we need 2 things here: one format for diff-exporting with complete info, and one for human viewing (which is, again, the primary reason why I needed this feature, so I'm not very keen on letting all this work finally not being useful for me :). Commands for saving/mailing patches could issue a bold warning if the user specifies the for-human-viewing flag.

Show 11 quoted lines
> > Compare this to the addition of the "file rename" feature (correct me
> > if I'm wrong): it was added without bothering whether plain old
> > "patch" can deal with it,...
> 
> Sorry, but that's an old history whie git-diff output format was rapidly
> being developed, when we did not have that many users, and when we did not
> have an old version of git-apply that did not understand the new feature
> in majority of user's hands.
> 
> We do not have that kind of luxury anymore.  git is much more widespread
> now and the majority of people use pre-1.6.1 git now (including me ;-)).

I was talking about exchanging patches with the non-git part of the world. The point is that eg. GNU patch still happily accepts git-generated files but produces nonsense using some, exactly because it ignores meaningful data which (by design ?) appear to it to be legal to ignore.

Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 15 in “Detection of directory renames”
  1. 0/3 Detection of directory renamesYann Dirson, Nov 1, 2008
  2. 1/3 Fix error in diff_filepair::status documentation.Yann Dirson, Nov 1, 2008
  3. Junio C HamanoNov 2, 2008
  4. 2/3 Introduce rename factorization in diffcore.Yann Dirson, Nov 1, 2008
  5. Junio C HamanoNov 7, 2008
  6. Yann DirsonNov 7, 2008
  7. Junio C HamanoNov 7, 2008
  8. Yann DirsonNov 7, 2008
  9. Junio C HamanoNov 7, 2008
  10. Yann DirsonNov 7, 2008
  11. Junio C HamanoNov 7, 2008
  12. Yann DirsonNov 8, 2008
  13. Junio C HamanoNov 8, 2008
  14. Yann DirsonNov 8, 2008
  15. 3/3 Add testcases for the --factorize-renames diffcore flag.Yann Dirson, Nov 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.