From: Ivo Anjo Date: Mon, 01 Feb 2010 11:48:27 GMT Subject: Bug in git-filter-branch example Message-ID: <557ea2711002010348m57aa31fesd1047cbe3f01cb0b@mail.gmail.com> 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