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

Re: filenames with " b" in them create confusing git diff-tree output

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 20, 2007, 20:23 UTC
Message-ID
<alpine.LFD.0.98.0706201315310.3593@woody.linux-foundation.org>
In-Reply-To
<7v4pl2v1lf.fsf@assigned-by-dhcp.pobox.com>
On Wed, 20 Jun 2007, Junio C Hamano wrote:
Show 5 quoted lines
> 
> Your example, "a/test b/foo" vs "b/test b/foo", can be and IS
> parsed unambiguously by git-apply (you can try "git apply
> --stat" your example).  IOW, the code to correctly handle it
> already exists ;-)

Well, in all fairness, I *did* hate having to write the code to handle all the name handling in git-apply.

Escaping whitespace (or at least giving the _option_ to do so) might well be a good way to not have to be as smart as git-apply is.

git-apply didn't have that option, since git-apply has as one primary motivation the need to be able to handle patches that come from non-git sources, so git-apply goes to quite some extreme lengths to try to make sense of an inherently rather ambiguous format (that the git diffs then *made* unambiguous, but using pretty subtle rules in order to stay compatible).

Some maybe we should have some generic method of asking for any filename to be quoted in particular ways?

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “filenames with " b" in them create confusing git diff-tree output”
  1. Paul MackerrasJun 20, 2007
  2. Junio C HamanoJun 20, 2007
  3. Linus TorvaldsJun 20, 2007
  4. Junio C HamanoJun 20, 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.