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

Re: [PATCH] Try URI quoting for embedded TAB and LF in pathnames

From
Junio C Hamano <junkio@cox.net>
Date
Oct 9, 2005, 10:42 UTC
Message-ID
<7vk6gnezuu.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051008133032.GA32079@localhost>
Robert Fitzsimons <robfitz@273k.net> writes:
> Instead of using //{LF}// and //{TAG}// to quote embedded tab and
> linefeed characters in pathnames use URI quoting.

I changed my mind, although I still do not particularly like the innocuous looking C-style or URI-style quoting, simply because I feel these funny characters should stand out loudly, but at the same time I realize that is just a matter of personal taste. Also the list does not seem to mind losing an extra unusual character (either backslash or per-cent) for quoting too much.

After futzing with this a bit more, I decided that C-style quoting is the cleanest way in the longer run. I'll be talking with the current maintainer of GNU patch about making it understand C-style quoting in its input, when the program operates under --quoting-style=c flag (or maybe some other flag).

In addition to git-diff output, git-ls-files output is also quoted for TAB and LF (and backslash) when not using '-z' in the version I have in the "pu" branch. I haven't converted git-ls-tree yet, but that should also be done before these changes can graduate out of "pu" branch.

Existing Porcelains or people's scripts should not break (any more than they currently are broken ;-). Any self-respecting Porcelain should be either parsing '-z' output (in which case there is no change), or parsing non '-z' output after declaring that it does not support filenames with embedded TAB or LF (in which case there is no new breakage, except that they have one more character that their users cannot have in the filename -- backslash).

Here is an example output from my random repository, that has files with TAB, LF and backslash in their names (Note that the file "pc" + one backslash + "h.c" is shown with two backslashes).

	: siamese; git status
        # Updated but not checked in:
        #   (will commit)
        #
        #	new file: ab\n\tc/mno
        #	modified: abc/mno
        #	renamed: def\nghi/pqr -> dee/pqr
        #	new file: dee/www
        #	modified: j  k l
        #
        #
        # Changed but not updated:
        #   (use git-update-index to mark for commit)
        #
        #	deleted:  abc/mno
        #
        #
        # Ignored files:
        #   (use "git add" to add to commit)
        #
        #	diff-sample
        #	pc\\h.c
        #	pch.c.orig
        #	quote\targ.c
        #	quotearg.c.orig
	: siamese; git diff HEAD
        diff --git a/abc/mno b/ab\n\tc/mno
        similarity index 72%
        rename from abc/mno
        rename to ab\n\tc/mno
        index 0ac2a8c..3deac99 100644
        --- a/abc/mno
        +++ b/ab\n\tc/mno
        @@ -1 +1,3 @@
         Fri Oct  7 23:18:45 PDT 2005
        +foo
        +foo
        ...
        : siamese; git diff HEAD | git apply --index-info
        100644 0ac2a8c8cad088c3e843689dbd833aeabf6b1870	abc/mno
        100644 9ee055c103e84ffdd9ec15457481c92699d12fc8	def\nghi/pqr
	...

Anyway, I'll keep this in the "pu" branch a bit longer to let the discussion simmer.

Previous: H. Peter AnvinNext: Junio C Hamano
Message 21 of 33 in “[RFC] embedded TAB and LF in pathnames”
  1. Junio C HamanoOct 7, 2005
  2. Alex RiesenOct 7, 2005
  3. Junio C HamanoOct 7, 2005
  4. Alex RiesenOct 8, 2005
  5. Junio C HamanoOct 8, 2005
  6. Try URI quoting for embedded TAB and LF in pathnamesRobert Fitzsimons, Oct 8, 2005
  7. Junio C HamanoOct 8, 2005
  8. Junio C HamanoOct 8, 2005
  9. Paul EggertOct 11, 2005
  10. Junio C HamanoOct 11, 2005
  11. Linus TorvaldsOct 11, 2005
  12. Paul EggertOct 11, 2005
  13. Linus TorvaldsOct 11, 2005
  14. Paul EggertOct 11, 2005
  15. Linus TorvaldsOct 11, 2005
  16. Paul EggertOct 12, 2005
  17. Linus TorvaldsOct 12, 2005
  18. Daniel BarkalowOct 12, 2005
  19. Linus TorvaldsOct 12, 2005
  20. H. Peter AnvinOct 12, 2005
  21. Junio C HamanoOct 9, 2005
  22. Junio C HamanoOct 12, 2005
  23. Linus TorvaldsOct 12, 2005
  24. H. Peter AnvinOct 12, 2005
  25. Johannes SchindelinOct 12, 2005
  26. Junio C HamanoOct 12, 2005
  27. Paul EggertOct 14, 2005
  28. Linus TorvaldsOct 14, 2005
  29. Linus TorvaldsOct 12, 2005
  30. Paul EggertOct 14, 2005
  31. Linus TorvaldsOct 14, 2005
  32. H. Peter AnvinOct 14, 2005
  33. Junio C HamanoOct 14, 2005

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.