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

Re: git-apply{,mbox,patch} should default to --unidiff-zero

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 6, 2007, 04:12 UTC
Message-ID
<alpine.LFD.0.98.0707052108070.9434@woody.linux-foundation.org>
In-Reply-To
<Pine.LNX.4.64.0707060413190.4093@racer.site>
On Fri, 6 Jul 2007, Johannes Schindelin wrote:
Show 7 quoted lines
> 
> With --unidiff-zero, also _adding_ lines will be handled as if there were 
> no problem.
> 
> Yes, in your case it fixes a problem.
> 
> Yet, in other cases it introduces a problem.

Well, we could make the rule be that ew require --unidiff-zero only if there really is _no_ old data to verify in a hunk. No deleted lines, and no context around it.

Adrian has a point in that if there are lines to be deleted, that in itself is context, and then the strict behaviour of "git-apply" is arguably unnecessaily strict.

That said, I do absolutely _hate_ how GNU patch will basically apply random line noise without complaints. So git-apply is designed to be much stricter on _so_ many levels. The thing that I personally always really detested about GNU patch was how it would apply part of a patch, then fail half-way, and leave the partial patch applied!

git-apply is about a million times better than standard "patch", exactly because it tries to make sure that what it does makes sense, and you actually need to use explicit flags to make it do things that may be hard to undo or slightly questionable.

		Linus
Previous: Johannes SchindelinNext: Junio C Hamano
Message 7 of 10 in “git-apply{,mbox,patch} should default to --unidiff-zero”
  1. Adrian BunkJul 5, 2007
  2. Johannes SchindelinJul 6, 2007
  3. Adrian BunkJul 6, 2007
  4. Johannes SchindelinJul 6, 2007
  5. Adrian BunkJul 6, 2007
  6. Johannes SchindelinJul 6, 2007
  7. Linus TorvaldsJul 6, 2007
  8. Junio C HamanoJul 6, 2007
  9. Adrian BunkJul 6, 2007
  10. Johannes SchindelinJul 6, 2007

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.