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

Re: git apply vs. renamed files index mismatch

From
AVAnton Vorontsov <avorontsov@ru.mvista.com>
Date
Sep 9, 2008, 15:14 UTC
Message-ID
<20080909151446.GA10395@oksana.dev.rtsoft.ru>
In-Reply-To
<7vtzcp8jk0.fsf@gitster.siamese.dyndns.org>
On Tue, Sep 09, 2008 at 07:45:19AM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> Anton Vorontsov <avorontsov@ru.mvista.com> writes:
> 
> > Now consider the following patch (modified by hand: it should say
> > +foo, but I changed it to +bar).
> > ...
> > The "index ..." stuff says that there are no changes and it is
> > pure rename, but obviously there is a change.
> 
> Ah, I see what you mean.  But in general, it is not obvious at all.
> 
> If you have the identical preimage (recorded on the LHS of the index line)
> or the patch reproduces the postimage in full (i.e. "create a new file"),
> you *could* notice.  It's an interesting idea from git person's point of
> view (i.e. "would be fun to implement"), but I doubt it would be useful in
> practice, because:
> 
>  (1) You often do not have the identically matching preimage;
> 
>  (2) More importantly, it is not unusual for people to *edit* the patch in
>      their MUA (think of typofixes), after getting it out of git.
Not for rename patches...
>  (3) Even more importantly, even if you notice there is some difference,
Just noticing that there is a difference is enough.
As for implementing, isn't this as simple as this pseudo code:
if (index_deleted_file == index_new_file)
	if (deleted_file != new_file)
		printk("warning\n");
In the git-apply?
-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 11 in “git apply vs. renamed files index mismatch (was: Re: [PATCH 1/4] POWERPC: Rename dma_64.c to dma.c)”
  1. Anton VorontsovSep 8, 2008
  2. Scott WoodSep 8, 2008
  3. Anton VorontsovSep 8, 2008
  4. Junio C HamanoSep 9, 2008
  5. Geert UytterhoevenSep 9, 2008
  6. Christoph HellwigSep 8, 2008
  7. Junio C HamanoSep 9, 2008
  8. Anton VorontsovSep 9, 2008
  9. Junio C HamanoSep 9, 2008
  10. Anton VorontsovSep 9, 2008
  11. Junio C HamanoSep 10, 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.