Re: git-apply{,mbox,patch} should default to --unidiff-zero
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 6, 2007, 01:51 UTC
- Message-ID
- <Pine.LNX.4.64.0707060243110.4093@racer.site>
- In-Reply-To
- <20070706014222.GK3492@stusta.de>
Hi,
On Fri, 6 Jul 2007, Adrian Bunk wrote:
Show 13 quoted lines
> On Fri, Jul 06, 2007 at 02:18:46AM +0100, Johannes Schindelin wrote:
>
> > On Fri, 6 Jul 2007, Adrian Bunk wrote:
> >
> > > git-apply{,mbox,patch} should default to doing --unidiff-zero:
> >
> > But is that not dangerous? At least now the committer has some
> > safeguard against this kind of mistakes. Because you can easily
> > introduce mistakes that way.
>
> you are saying "easily".
>
> Did you ever actually run into such a problem?Not yet, thankfully.
> You must do something like "diff -U0" or manually editing patches for > creating such patches, and that's very unusual.
The point is that the _committer_ is not necessarily involved in that business.
And "git apply" is strict for a reason. It catches possibly unwanted things much earlier than patch. I _want_ to be warned that somebody is introducing some code at a certain position, which might, or might not be correct. apply has no way to tell, since there is no context to at least minimally verify.
> And although GNU patch (which has a much bigger userbase than git) > applies such patches without any warning I don't remember having ever > seen what you call "easily".
GNU patch is very sloppy. And I had to fix up quite a number of patches which were "successfully" applied, but did not do what they were supposed to do. The recent "GNU patch applies _indented_ _context_ diffs" fracass is only one example why I prefer git apply.
Unfortunately, I do not off-hand remember if I had to fix up a unified-zero patch that GNU patch applied, but I do know this:
if "git am" learns to apply unified-zero by default, the first thing I will do is patch it in my Git branch to _not_ do that. I do _not_ want that. I want to be warned.
I can still decide that it is probably okay, but I will make _damned_ _well_ sure afterwards that it did something sensible. I will _only_ apply such a scrutiny when git apply refused to apply a unified-zero patch, and I decided to apply it nevertheless.
Ciao, Dscho