Re: Why doesn't git-apply remove empty file

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Stephan Beyer <s-beyer@...>
Cc: Francis Moreau <francis.moro@...>, René Scharfe <rene.scharfe@...>, Junio C Hamano <gitster@...>, <git@...>
Date: Friday, August 15, 2008 - 11:53 am

On Thu, 14 Aug 2008, Stephan Beyer wrote:

It's really hard to do. Largely impossible, I think. The reason is that 
when a patch fails, you - by definition - don't really know where it is 
supposed to apply and what the original code is. Because if you did, the 
patch wouldn't fail!

Git *can* do it (git am -3, as people have said), when you have a git 
patch, and the patch indicates the original blob. Then git can just see 
what the original state was, reconstruct the patched file, and do a normal 
three-way merge. But it's not doable in general.

Now, we could do other things, like try to _search_ for an original blob 
that it applies cleanly to (or even have a "guessing mode" that does a 
really rough patch-application with the GNU patch defaults and then does a 
three-way merge of a fudged version with no fuzz as the base), so I'm not 
saying that it would be fundamentally impossible to try to go further than 
what we do now, but it's definitely not trivial to do.


I do agree that it would be very cool. I'm so used to editing patches to 
match the target files by hand that I don't personally mind. I absolutely 
detest reject files personally because of the way they mean that you have 
a half-way done thing, so I will literally always edit the original patch 
in place instead.

But I agree that what you describe would be absolutely lovely.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Why doesn't git-apply remove empty file, Francis Moreau, (Tue Aug 12, 12:17 pm)
Re: Why doesn't git-apply remove empty file, Junio C Hamano, (Tue Aug 12, 8:25 pm)
Re: Why doesn't git-apply remove empty file, Francis Moreau, (Wed Aug 13, 3:48 am)
Re: Why doesn't git-apply remove empty file, René Scharfe, (Wed Aug 13, 5:52 pm)
Re: Why doesn't git-apply remove empty file, Linus Torvalds, (Wed Aug 13, 7:09 pm)
Re: Why doesn't git-apply remove empty file, Francis Moreau, (Thu Aug 14, 3:42 pm)
Re: Why doesn't git-apply remove empty file, Linus Torvalds, (Thu Aug 14, 3:57 pm)
Re: Why doesn't git-apply remove empty file, Francis Moreau, (Thu Aug 14, 4:17 pm)
Re: Why doesn't git-apply remove empty file, Linus Torvalds, (Thu Aug 14, 4:02 pm)
Re: Why doesn't git-apply remove empty file, Stephan Beyer, (Thu Aug 14, 4:21 pm)
Re: Why doesn't git-apply remove empty file, Linus Torvalds, (Fri Aug 15, 11:53 am)
Re: Why doesn't git-apply remove empty file, Jeff King, (Thu Aug 14, 4:54 pm)
Re: Why doesn't git-apply remove empty file, Stephan Beyer, (Thu Aug 14, 5:10 pm)
Re: Why doesn't git-apply remove empty file, Jeff King, (Fri Aug 15, 12:08 am)