Bug in git-filter-branch example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]