git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joey Hess <joey@kitenet.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: Re: git log and utf-u in filenames
Date: Thu, 25 Sep 2008 18:43:54 -0400	[thread overview]
Message-ID: <20080925224354.GA6072@kodama.kitenet.net> (raw)
In-Reply-To: <20080925215002.GA30810@kodama.kitenet.net>

[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]

Joey Hess wrote:
> And did earlier versions of git (circa 2006) perhaps
> not do that escaping? I have code in ikiwiki that apparently used to work, but
> is certianly not working with current git, due to this escaping.

No, I guess it's always done that, perhaps something broke on my side
in the meantime.

But it doesn't seem right somehow that gitweb, ikiwiki, and seemingly
any other program that needs to look at git log / commits and figure out
what filename is being changed needs to include their own nasty code[1] to
convert the escaped characters back to normal characters.

And it seems that anyone who uses a lot of utf-8 in filenames would shortly
get tired of git commit, git log, etc displaying obfuscated versions of their
filenames.

I'm sure it makes sense to use this format internally in git to represent
filenames, to avoid needing to worry about encoding issues. But it's a shame
that that internal detail is exposed so that everything around git has to
worry about it.

Would making git-log and git-commit display de-escaped filenames be likely
to break something?

-- 
see shy jo

[1] Such as this from gitweb:

# git may return quoted and escaped filenames
sub unquote {
        my $str = shift;

        sub unq {
                my $seq = shift;
                my %es = ( # character escape codes, aka escape sequences
                        't' => "\t",   # tab            (HT, TAB)
                        'n' => "\n",   # newline        (NL)
                        'r' => "\r",   # return         (CR)
                        'f' => "\f",   # form feed      (FF)
                        'b' => "\b",   # backspace      (BS)
                        'a' => "\a",   # alarm (bell)   (BEL)
                        'e' => "\e",   # escape         (ESC)
                        'v' => "\013", # vertical tab   (VT)
                );

                if ($seq =~ m/^[0-7]{1,3}$/) {
                        # octal char sequence
                        return chr(oct($seq));
                } elsif (exists $es{$seq}) {
                        # C escape sequence, aka character escape code
                        return $es{$seq};
                }
                # quoted ordinary character
                return $seq;
        }

        if ($str =~ m/^"(.*)"$/) {
                # needs unquoting
                $str = $1;
                $str =~ s/\\([^0-7]|[0-7]{1,3})/unq($1)/eg;
        }
        return $str;
}

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2008-09-25 22:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 21:50 git log and utf-u in filenames Joey Hess
2008-09-25 22:43 ` Joey Hess [this message]
2008-09-25 23:15   ` Jakub Narebski
2008-09-26  6:33     ` Alex Riesen
2008-09-26  7:31       ` Jakub Narebski
2008-09-26 13:49         ` Alex Riesen
2008-09-27  8:37           ` Jakub Narebski
2008-09-25 23:11 ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080925224354.GA6072@kodama.kitenet.net \
    --to=joey@kitenet.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).