{"thread":{"id":"12953","subject":"BUG: \"git add --interactive\" does not work with UTF-8 filenames","startedAt":"2008-04-01T19:32:03Z","lastAt":"2008-04-02T17:18:58Z","messageCount":8,"participants":["Teemu Likonen","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"73511","messageId":"200804012232.03559.tlikonen@iki.fi","threadId":"12953","inReplyTo":null,"subject":"BUG: \"git add --interactive\" does not work with UTF-8 filenames","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-04-01T19:32:03Z","receivedAt":"2008-04-01T19:32:03Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"I just learnt that \"git add --interactive\" does not work with UTF-8 \nencoded filenames. Maybe it's about all 8-bit characters.\n\nThe menu invoked with command\n\n  git add -i <file>\n\ndoes not even show this <file> if the name contains UTF-8 characters. \nCommand and menu\n\n  git add -i\n\nshows the file but nothing can be done with it. Neither \"patch\" \nnor \"update\" does work, for example.\n\n\nAs a side note/rant: Git tends to show non-Ascii characters in filenames \nas \\xxx escape sequences. It's not a big problem but surely it's not \nvery nice to read if (say) half of the word's letters are escaped like \nthis. I believe Git is mostly used for tracking source codes where \nAscii-only filenames are a common practice. I'm using Git to develop \nFinnish spell-checking system (called Voikko) and we have some \nnon-Ascii filenames in the repo.\n"},{"id":"73513","messageId":"m3y77xtk32.fsf@localhost.localdomain","threadId":"12953","inReplyTo":"200804012232.03559.tlikonen@iki.fi","subject":"Re: BUG: \"git add --interactive\" does not work with UTF-8 filenames","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-04-01T20:08:07Z","receivedAt":"2008-04-01T20:08:07Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Teemu Likonen <tlikonen@iki.fi> writes:\n\n> As a side note/rant: Git tends to show non-Ascii characters in filenames \n> as \\xxx escape sequences. It's not a big problem but surely it's not \n> very nice to read if (say) half of the word's letters are escaped like \n> this. I believe Git is mostly used for tracking source codes where \n> Ascii-only filenames are a common practice. I'm using Git to develop \n> Finnish spell-checking system (called Voikko) and we have some \n> non-Ascii filenames in the repo.\n\ngit-config(1):\n\n  core.quotepath::\n\tThe commands that output paths (e.g. `ls-files`,\n\t`diff`), when not given the `-z` option, will quote\n\t\"unusual\" characters in the pathname by enclosing the\n\tpathname in a double-quote pair and with backslashes the\n\tsame way strings in C source code are quoted.  If this\n\tvariable is set to false, the bytes higher than 0x80 are\n\tnot quoted but output as verbatim.  Note that double\n\tquote, backslash and control characters are always\n\tquoted without `-z` regardless of the setting of this\n\tvariable.\n\nSince 1.5.2.2 (I think), or at least 1.5.3, so you have new enough\nversion of git (git is now at 1.5.5-rc2).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"73514","messageId":"200804012329.09565.tlikonen@iki.fi","threadId":"12953","inReplyTo":"m3y77xtk32.fsf@localhost.localdomain","subject":"Re: BUG: \"git add --interactive\" does not work with UTF-8 filenames if core.quotepath=true","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-04-01T20:29:09Z","receivedAt":"2008-04-01T20:29:09Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Jakub Narebski kirjoitti:\n\n> git-config(1):\n>\n>   core.quotepath::\n\nAh, thanks! This whole bug disappeared when I set core.quotepath=false \ni.e. \"git add -i\" works fine with UTF-8 filenames too.\n\nHowever, the bug remains when core.quotepath=true or it's unconfigured.\n"},{"id":"73523","messageId":"7v63v1ccmb.fsf@gitster.siamese.dyndns.org","threadId":"12953","inReplyTo":"m3y77xtk32.fsf@localhost.localdomain","subject":"Re: BUG: \"git add --interactive\" does not work with UTF-8 filenames","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-02T00:41:00Z","receivedAt":"2008-04-02T00:41:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> git-config(1):\n>\n>   core.quotepath::\n> \tThe commands that output paths (e.g. `ls-files`,\n> \t`diff`), when not given the `-z` option, will quote\n> \t\"unusual\" characters in the pathname by enclosing the\n> \tpathname in a double-quote pair and with backslashes the\n> \tsame way strings in C source code are quoted.  If this\n> \tvariable is set to false, the bytes higher than 0x80 are\n> \tnot quoted but output as verbatim.  Note that double\n> \tquote, backslash and control characters are always\n> \tquoted without `-z` regardless of the setting of this\n> \tvariable.\n>\n> Since 1.5.2.2 (I think), or at least 1.5.3, so you have new enough\n> version of git (git is now at 1.5.5-rc2).\n\nYes, but I do not think \"add -i\" unwraps the path quoting.  I think it\nshould, but I do not think I bothered to.  Because it is trivial to do by\nany aspiring git hacker wannabes, I left it as an exercise to readers when\nI did the \"interactive\" as a quick-and-dirty hack (aka \"demonstration\").\n\nSomehow nobody found an itch to improve it until now, but it seems that we\nfound a volunteer with the itch ;-)\n"},{"id":"73541","messageId":"200804021317.16007.jnareb@gmail.com","threadId":"12953","inReplyTo":"7v63v1ccmb.fsf@gitster.siamese.dyndns.org","subject":"Re: BUG: \"git add --interactive\" does not work with UTF-8 filenames","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-04-02T11:17:14Z","receivedAt":"2008-04-02T11:17:14Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > git-config(1):\n> >\n> >   core.quotepath::\n> > \tThe commands that output paths (e.g. `ls-files`,\n> > \t`diff`), when not given the `-z` option, will quote\n> > \t\"unusual\" characters in the pathname by enclosing the\n> > \tpathname in a double-quote pair and with backslashes the\n> > \tsame way strings in C source code are quoted.  If this\n> > \tvariable is set to false, the bytes higher than 0x80 are\n> > \tnot quoted but output as verbatim.  Note that double\n> > \tquote, backslash and control characters are always\n> > \tquoted without `-z` regardless of the setting of this\n> > \tvariable.\n> >\n> > Since 1.5.2.2 (I think), or at least 1.5.3, so you have new enough\n> > version of git (git is now at 1.5.5-rc2).\n> \n> Yes, but I do not think \"add -i\" unwraps the path quoting.  I think it\n> should, but I do not think I bothered to.  Because it is trivial to do by\n> any aspiring git hacker wannabes, I left it as an exercise to readers when\n> I did the \"interactive\" as a quick-and-dirty hack (aka \"demonstration\").\n\nBy the way, the code to unwrap the path quoting can be found in gitweb\nas unescape() subroutine... or git-add--interactive can use '-z' switch.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"73548","messageId":"7v3aq49ryo.fsf@gitster.siamese.dyndns.org","threadId":"12953","inReplyTo":"200804021317.16007.jnareb@gmail.com","subject":"Re: BUG: \"git add --interactive\" does not work with UTF-8 filenames","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-02T15:50:07Z","receivedAt":"2008-04-02T15:50:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> By the way, the code to unwrap the path quoting can be found in gitweb\n> as unescape() subroutine... or git-add--interactive can use '-z' switch.\n\nYes, but if you use '-z' to read from plumbing, you would need your own\nwrapping on the UI side to protect your output from control characters\n(most notably LF) embedded in pathnames.\n\nAlso I had an impression that the compatibility implementation of\nrun_cmd_pipe() had some issues with NUL terminated list.\n"},{"id":"73550","messageId":"20080402170646.GA12711@mithlond.arda.local","threadId":"12953","inReplyTo":"7v63v1ccmb.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i'","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-04-02T17:06:46Z","receivedAt":"2008-04-02T17:06:46Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"The command 'git add -i' (i.e. the interactive mode) can't handle\nfiles which have non-Ascii characters in their name unless the option\ncore.quotepath is set to false. This patch adds a description of the bug\nto the git-add.txt manual.\n---\n\nJunio C Hamano kirjoitti (1.4.2008 klo 17.41):\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > git-config(1):\n> >\n> >   core.quotepath::\n> > \tThe commands that output paths (e.g. `ls-files`,\n> > \t`diff`), when not given the `-z` option, will quote\n> > \t\"unusual\" characters in the pathname by enclosing the\n> > \tpathname in a double-quote pair and with backslashes the\n> > \tsame way strings in C source code are quoted.  If this\n> > \tvariable is set to false, the bytes higher than 0x80 are\n> > \tnot quoted but output as verbatim.  Note that double\n> > \tquote, backslash and control characters are always\n> > \tquoted without `-z` regardless of the setting of this\n> > \tvariable.\n> \n> Yes, but I do not think \"add -i\" unwraps the path quoting.  I think it\n> should, but I do not think I bothered to.  Because it is trivial to do\n> by any aspiring git hacker wannabes, I left it as an exercise to\n> readers when I did the \"interactive\" as a quick-and-dirty hack (aka\n> \"demonstration\").\n> \n> Somehow nobody found an itch to improve it until now, but it seems\n> that we found a volunteer with the itch ;-)\n\nUnfortunately we found a non-programmer :) My itch (both of them)\ndisappeared pretty much at the moment I set core.quotepath to false\n(thanks Jakub). But this patch is the kind of contribution I can do at\nthe present moment.\n\n\n Documentation/git-add.txt |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-add.txt b/Documentation/git-add.txt\nindex c751a17..f085b15 100644\n--- a/Documentation/git-add.txt\n+++ b/Documentation/git-add.txt\n@@ -226,6 +226,13 @@ diff::\n   This lets you review what will be committed (i.e. between\n   HEAD and index).\n \n+Bugs\n+----\n+Files with non-Ascii characters in their name don't work in the interactive\n+mode (see above) unless option 'core.quotepath' is set to false. Setting\n+'core.quotepath' to false may be a good idea anyway if you need to handle\n+non-Ascii filenames. See linkgit:git-config[1] for more information about this\n+option.\n \n See Also\n --------\n-- \n1.5.5.rc2.15.g4db6\n"},{"id":"73551","messageId":"7vy77w89a5.fsf@gitster.siamese.dyndns.org","threadId":"12953","inReplyTo":"20080402170646.GA12711@mithlond.arda.local","subject":"Re: [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-02T17:18:58Z","receivedAt":"2008-04-02T17:18:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is not limited to non-ascii.  You would also need to warn about HT,\nLF and double-quotes in the filenames.\n\nI'd call this a limitation, though.\n"}]}