git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug in git-filter-branch example
@ 2010-02-01 11:48 Ivo Anjo
  2010-02-01 12:43 ` Jeff King
  2010-02-01 12:57 ` Johannes Sixt
  0 siblings, 2 replies; 3+ messages in thread
From: Ivo Anjo @ 2010-02-01 11:48 UTC (permalink / raw)
  To: git

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

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

end of thread, other threads:[~2010-02-01 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01 11:48 Bug in git-filter-branch example Ivo Anjo
2010-02-01 12:43 ` Jeff King
2010-02-01 12:57 ` Johannes Sixt

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).