Added a comment
authoryarikoptic <yarikoptic@web>
Mon, 24 Apr 2023 19:23:22 +0000 (19:23 +0000)
committeradmin <admin@branchable.com>
Mon, 24 Apr 2023 19:23:22 +0000 (19:23 +0000)
doc/bugs/started_to_escape_characters_in_the_output/comment_2_76c80e98cc2d26e4cebaac6e40e76df9._comment [new file with mode: 0644]

diff --git a/doc/bugs/started_to_escape_characters_in_the_output/comment_2_76c80e98cc2d26e4cebaac6e40e76df9._comment b/doc/bugs/started_to_escape_characters_in_the_output/comment_2_76c80e98cc2d26e4cebaac6e40e76df9._comment
new file mode 100644 (file)
index 0000000..f0ab0ba
--- /dev/null
@@ -0,0 +1,41 @@
+[[!comment format=mdwn
+ username="yarikoptic"
+ avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
+ subject="comment 2"
+ date="2023-04-24T19:23:22Z"
+ content="""
+hm, I didn't look inside `git` but `git diff` is likely to have it escaped because `patch` (and/or other unified diff operating tools) expect it such. In other words -- `git diff` must encode paths escaped because the \"diff standard\" expects it such.
+
+On the other hand, as you confirmed, `git add` just displays the name on the screen, and as such it does not bother escaping it since may be I just cut/paste it as a string which is \"raw\" and thus not expecting any escape characters.
+
+RTFMing [git-config on core.quotePath](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath)  I  spotted 
+
+> ... enclosing the pathname in double-quotes and escaping ...
+
+so it talks about double-quotes.  `git` `status`, `diff` report paths in double (`\"`) not single (`'`) quotes. I wonder if that is where/how `git` is consistent since in your example that is the difference too:
+
+```
+# current master git-annex
+joey@darkstar:~/tmp/xxx>git-annex add 'gl\orious'
+git-annex: \"gl\\orious\" not found
+joey@darkstar:~/tmp/xxx>git add 'gl\orious'
+fatal: pathspec 'gl\orious' did not match any files
+```
+
+that git uses `'` (and does not escape) while git annex uses `\"` (and escapes)?  Did you see git doing escaping in paths where it reports them within single (`'`) quotes?
+
+and thus git-annex should have just wrapped in `'` to become consistent with git in :
+
+```shell
+# released git-annex
+> git annex add --json --json-error-messages '\e[31mfo\o\e[0m'
+git-annex: \e[31mfo\o\e[0m not found
+add: 1 failed
+> git add '\e[31mfo\o\e[0m'
+fatal: pathspec '\e[31mfo\o\e[0m' did not match any files
+> git rm '\e[31mfo\o\e[0m'
+fatal: pathspec '\e[31mfo\o\e[0m' did not match any files
+```
+
+
+"""]]