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

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

From
ABAdrian Bunk <bunk@stusta.de>
Date
Jul 5, 2007, 23:22 UTC
Message-ID
<20070705232210.GR3492@stusta.de>
I just ran into the following issue:

I sent someone a patch that purposefully contained a chunk without context, and git-apply of the recipient refused to apply it without an explicit --unidiff-zero.

git-apply{,mbox,patch} should default to doing --unidiff-zero: Generating a patch without context is something I have to do explicitely by giving "diff" an option or by manually editing the patch. I know about the dangers of having no context, but there are use cases where I know that replacing and/or deleting one or more lines is safe even without context and where I want to avoid context e.g. for avoiding to clash with other patches.

Example use case: Look at the file Documentation/feature-removal-schedule.txt in the Linux kernel. If I want to send someone two independent patches removing adjanced entries in this file, the patches can be applied in any order exactly as long as this chunk does not contain any context. Removing an entry from this file is obviously safe even without any context.

TIA Adrian

BTW: Please Cc me on replies.
-- 
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
Next: Johannes Schindelin
Message 1 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.