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

Re: [PATCH] Make apply accept the -pNUM option like patch does.

From
Linus Torvalds <torvalds@osdl.org>
Date
Jan 31, 2006, 17:01 UTC
Message-ID
<Pine.LNX.4.64.0601310856381.7301@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0601310015460.25300@iabervon.org>
On Tue, 31 Jan 2006, Daniel Barkalow wrote:
>
> This only applies to traditional diffs, not to git diffs.

Also, be careful: the default for git-apply is very different from the default for a regular "patch".

"patch" without any "-p" at all will try to automagically figure out the right file, which has burnt me more than once when you have the same name (usually "Makefile") in multiple sub-directories and "patch" makes the wrong automagic guess.

git-apply with this patch will continue to use -p1. No guessing, no gray areas.

I do believe that the right thing to do is to just make SVN output "-p1" patches (I cannot imagine that you can't do so, since -p1 is a much saner format than -p0), but I guess teaching git-apply to take -pN for traditional patches is fine.

But if somebody suggests we do the automatic thing that "patch" does, I'll scream. Too many times have I been burnt by patch being "helpful" (in general, patch by default will try very hard to apply a patch, whether it makes sense or not).

		Linus
Previous: Daniel Barkalow
Message 4 of 4 in “Importing diffs”
  1. Ian MoltonJan 30, 2006
  2. Greg KHJan 30, 2006
  3. Make apply accept the -pNUM option like patch does.Daniel Barkalow, Jan 31, 2006
  4. Linus TorvaldsJan 31, 2006

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.