git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo Anjo <knuckles@gmail.com>
To: git@vger.kernel.org
Subject: Bug in git-filter-branch example
Date: Mon, 1 Feb 2010 11:48:27 +0000	[thread overview]
Message-ID: <557ea2711002010348m57aa31fesd1047cbe3f01cb0b@mail.gmail.com> (raw)

I've been working on importing my svn repo into git, and while moving
some things around using git-filter-branch I ran into a bug in the
example provided on the manpage:

    To move the whole tree into a subdirectory, or remove it from there:

    git filter-branch --index-filter \
            'git ls-files -s | sed "s-\t-&newsubdir/-" |
                    GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                            git update-index --index-info &&
             mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD


The problem is with filenames that use complex utf8 (non-ascii?) chars:

> ls -lah Papers/*Lea*
-rw-r--r-- 1 knuckles users 109K 2010-01-31 18:57 Papers/A Java Fork ⁄
Join Framework -- Lea.pdf

as you can see, I'm using '⁄' as a replacement for '/' on that
filename, since I obviously can't use '/' on a filename. The problem
is, git ls-files -s lists that file wrapped in quotes and with the
char value escaped

100644 c09309342037fa7d91f37651e2f16e981e4d739a 0    "Papers/A Java
Fork \342\201\204 Join Framework -- Lea.pdf"

while other files aren't, so the simple sed line provided won't work,
as it will output the new filename as newsubdir/"Papers...

I ended up using git filter-branch to remove the offending file ("if
all you have is a hammer..."), and re-adding it after the move.

I'm also left wondering how many uses of git ls-files out there on the
"internets" survive working on a filename such as this one. Maybe git
ls-files should have an option to output the real utf8 file name
instead of escaping the bytes...?

Ivo Anjo

             reply	other threads:[~2010-02-01 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 11:48 Ivo Anjo [this message]
2010-02-01 12:43 ` Bug in git-filter-branch example Jeff King
2010-02-01 12:57 ` Johannes Sixt

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=557ea2711002010348m57aa31fesd1047cbe3f01cb0b@mail.gmail.com \
    --to=knuckles@gmail.com \
    --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).