git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* BUG: "git add --interactive" does not work with UTF-8 filenames
@ 2008-04-01 19:32 Teemu Likonen
  2008-04-01 20:08 ` Jakub Narebski
  0 siblings, 1 reply; 8+ messages in thread
From: Teemu Likonen @ 2008-04-01 19:32 UTC (permalink / raw)
  To: git

I just learnt that "git add --interactive" does not work with UTF-8 
encoded filenames. Maybe it's about all 8-bit characters.

The menu invoked with command

  git add -i <file>

does not even show this <file> if the name contains UTF-8 characters. 
Command and menu

  git add -i

shows the file but nothing can be done with it. Neither "patch" 
nor "update" does work, for example.


As a side note/rant: Git tends to show non-Ascii characters in filenames 
as \xxx escape sequences. It's not a big problem but surely it's not 
very nice to read if (say) half of the word's letters are escaped like 
this. I believe Git is mostly used for tracking source codes where 
Ascii-only filenames are a common practice. I'm using Git to develop 
Finnish spell-checking system (called Voikko) and we have some 
non-Ascii filenames in the repo.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: BUG: "git add --interactive" does not work with UTF-8 filenames
  2008-04-01 19:32 BUG: "git add --interactive" does not work with UTF-8 filenames Teemu Likonen
@ 2008-04-01 20:08 ` Jakub Narebski
  2008-04-01 20:29   ` BUG: "git add --interactive" does not work with UTF-8 filenames if core.quotepath=true Teemu Likonen
  2008-04-02  0:41   ` BUG: "git add --interactive" does not work with UTF-8 filenames Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Jakub Narebski @ 2008-04-01 20:08 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: git

Teemu Likonen <tlikonen@iki.fi> writes:

> As a side note/rant: Git tends to show non-Ascii characters in filenames 
> as \xxx escape sequences. It's not a big problem but surely it's not 
> very nice to read if (say) half of the word's letters are escaped like 
> this. I believe Git is mostly used for tracking source codes where 
> Ascii-only filenames are a common practice. I'm using Git to develop 
> Finnish spell-checking system (called Voikko) and we have some 
> non-Ascii filenames in the repo.

git-config(1):

  core.quotepath::
	The commands that output paths (e.g. `ls-files`,
	`diff`), when not given the `-z` option, will quote
	"unusual" characters in the pathname by enclosing the
	pathname in a double-quote pair and with backslashes the
	same way strings in C source code are quoted.  If this
	variable is set to false, the bytes higher than 0x80 are
	not quoted but output as verbatim.  Note that double
	quote, backslash and control characters are always
	quoted without `-z` regardless of the setting of this
	variable.

Since 1.5.2.2 (I think), or at least 1.5.3, so you have new enough
version of git (git is now at 1.5.5-rc2).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: BUG: "git add --interactive" does not work with UTF-8 filenames if core.quotepath=true
  2008-04-01 20:08 ` Jakub Narebski
@ 2008-04-01 20:29   ` Teemu Likonen
  2008-04-02  0:41   ` BUG: "git add --interactive" does not work with UTF-8 filenames Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Teemu Likonen @ 2008-04-01 20:29 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

Jakub Narebski kirjoitti:

> git-config(1):
>
>   core.quotepath::

Ah, thanks! This whole bug disappeared when I set core.quotepath=false 
i.e. "git add -i" works fine with UTF-8 filenames too.

However, the bug remains when core.quotepath=true or it's unconfigured.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: BUG: "git add --interactive" does not work with UTF-8 filenames
  2008-04-01 20:08 ` Jakub Narebski
  2008-04-01 20:29   ` BUG: "git add --interactive" does not work with UTF-8 filenames if core.quotepath=true Teemu Likonen
@ 2008-04-02  0:41   ` Junio C Hamano
  2008-04-02 11:17     ` Jakub Narebski
  2008-04-02 17:06     ` [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i' Teemu Likonen
  1 sibling, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2008-04-02  0:41 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Teemu Likonen, git

Jakub Narebski <jnareb@gmail.com> writes:

> git-config(1):
>
>   core.quotepath::
> 	The commands that output paths (e.g. `ls-files`,
> 	`diff`), when not given the `-z` option, will quote
> 	"unusual" characters in the pathname by enclosing the
> 	pathname in a double-quote pair and with backslashes the
> 	same way strings in C source code are quoted.  If this
> 	variable is set to false, the bytes higher than 0x80 are
> 	not quoted but output as verbatim.  Note that double
> 	quote, backslash and control characters are always
> 	quoted without `-z` regardless of the setting of this
> 	variable.
>
> Since 1.5.2.2 (I think), or at least 1.5.3, so you have new enough
> version of git (git is now at 1.5.5-rc2).

Yes, but I do not think "add -i" unwraps the path quoting.  I think it
should, but I do not think I bothered to.  Because it is trivial to do by
any aspiring git hacker wannabes, I left it as an exercise to readers when
I did the "interactive" as a quick-and-dirty hack (aka "demonstration").

Somehow nobody found an itch to improve it until now, but it seems that we
found a volunteer with the itch ;-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: BUG: "git add --interactive" does not work with UTF-8 filenames
  2008-04-02  0:41   ` BUG: "git add --interactive" does not work with UTF-8 filenames Junio C Hamano
@ 2008-04-02 11:17     ` Jakub Narebski
  2008-04-02 15:50       ` Junio C Hamano
  2008-04-02 17:06     ` [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i' Teemu Likonen
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2008-04-02 11:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Teemu Likonen, git

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > git-config(1):
> >
> >   core.quotepath::
> > 	The commands that output paths (e.g. `ls-files`,
> > 	`diff`), when not given the `-z` option, will quote
> > 	"unusual" characters in the pathname by enclosing the
> > 	pathname in a double-quote pair and with backslashes the
> > 	same way strings in C source code are quoted.  If this
> > 	variable is set to false, the bytes higher than 0x80 are
> > 	not quoted but output as verbatim.  Note that double
> > 	quote, backslash and control characters are always
> > 	quoted without `-z` regardless of the setting of this
> > 	variable.
> >
> > Since 1.5.2.2 (I think), or at least 1.5.3, so you have new enough
> > version of git (git is now at 1.5.5-rc2).
> 
> Yes, but I do not think "add -i" unwraps the path quoting.  I think it
> should, but I do not think I bothered to.  Because it is trivial to do by
> any aspiring git hacker wannabes, I left it as an exercise to readers when
> I did the "interactive" as a quick-and-dirty hack (aka "demonstration").

By the way, the code to unwrap the path quoting can be found in gitweb
as unescape() subroutine... or git-add--interactive can use '-z' switch.

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: BUG: "git add --interactive" does not work with UTF-8 filenames
  2008-04-02 11:17     ` Jakub Narebski
@ 2008-04-02 15:50       ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2008-04-02 15:50 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Teemu Likonen, git

Jakub Narebski <jnareb@gmail.com> writes:

> By the way, the code to unwrap the path quoting can be found in gitweb
> as unescape() subroutine... or git-add--interactive can use '-z' switch.

Yes, but if you use '-z' to read from plumbing, you would need your own
wrapping on the UI side to protect your output from control characters
(most notably LF) embedded in pathnames.

Also I had an impression that the compatibility implementation of
run_cmd_pipe() had some issues with NUL terminated list.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i'
  2008-04-02  0:41   ` BUG: "git add --interactive" does not work with UTF-8 filenames Junio C Hamano
  2008-04-02 11:17     ` Jakub Narebski
@ 2008-04-02 17:06     ` Teemu Likonen
  2008-04-02 17:18       ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Teemu Likonen @ 2008-04-02 17:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git

The command 'git add -i' (i.e. the interactive mode) can't handle
files which have non-Ascii characters in their name unless the option
core.quotepath is set to false. This patch adds a description of the bug
to the git-add.txt manual.
---

Junio C Hamano kirjoitti (1.4.2008 klo 17.41):

> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > git-config(1):
> >
> >   core.quotepath::
> > 	The commands that output paths (e.g. `ls-files`,
> > 	`diff`), when not given the `-z` option, will quote
> > 	"unusual" characters in the pathname by enclosing the
> > 	pathname in a double-quote pair and with backslashes the
> > 	same way strings in C source code are quoted.  If this
> > 	variable is set to false, the bytes higher than 0x80 are
> > 	not quoted but output as verbatim.  Note that double
> > 	quote, backslash and control characters are always
> > 	quoted without `-z` regardless of the setting of this
> > 	variable.
> 
> Yes, but I do not think "add -i" unwraps the path quoting.  I think it
> should, but I do not think I bothered to.  Because it is trivial to do
> by any aspiring git hacker wannabes, I left it as an exercise to
> readers when I did the "interactive" as a quick-and-dirty hack (aka
> "demonstration").
> 
> Somehow nobody found an itch to improve it until now, but it seems
> that we found a volunteer with the itch ;-)

Unfortunately we found a non-programmer :) My itch (both of them)
disappeared pretty much at the moment I set core.quotepath to false
(thanks Jakub). But this patch is the kind of contribution I can do at
the present moment.


 Documentation/git-add.txt |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index c751a17..f085b15 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -226,6 +226,13 @@ diff::
   This lets you review what will be committed (i.e. between
   HEAD and index).
 
+Bugs
+----
+Files with non-Ascii characters in their name don't work in the interactive
+mode (see above) unless option 'core.quotepath' is set to false. Setting
+'core.quotepath' to false may be a good idea anyway if you need to handle
+non-Ascii filenames. See linkgit:git-config[1] for more information about this
+option.
 
 See Also
 --------
-- 
1.5.5.rc2.15.g4db6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i'
  2008-04-02 17:06     ` [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i' Teemu Likonen
@ 2008-04-02 17:18       ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2008-04-02 17:18 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Jakub Narebski, git

This is not limited to non-ascii.  You would also need to warn about HT,
LF and double-quotes in the filenames.

I'd call this a limitation, though.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-02 17:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01 19:32 BUG: "git add --interactive" does not work with UTF-8 filenames Teemu Likonen
2008-04-01 20:08 ` Jakub Narebski
2008-04-01 20:29   ` BUG: "git add --interactive" does not work with UTF-8 filenames if core.quotepath=true Teemu Likonen
2008-04-02  0:41   ` BUG: "git add --interactive" does not work with UTF-8 filenames Junio C Hamano
2008-04-02 11:17     ` Jakub Narebski
2008-04-02 15:50       ` Junio C Hamano
2008-04-02 17:06     ` [PATCH] Describe the bug about handling non-Ascii filenames in 'git add -i' Teemu Likonen
2008-04-02 17:18       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).