Is git ls-files really character agnostic? If not, what is?
I’m working in Mac OS 10.6 with git version 1.7.0 .
If I execute
echo "" > frëd # that's f r \xEB d git ls-files --other 'f*'
I get back
"fre\314\210d" # that's 14 characters including two \'s
ls f* reports
frëd # 4 characters, 5 bytes
This causes poor behaviour in magit-status mode in Emacs.
How can I work around this and have git ls-files report the same way
that ls does, without interpreting the bytes of the filename?
One Solution collect form web for “Is git ls-files really character agnostic? If not, what is?”
Git escapes the filename so that it doesn’t contain any hard to interpret characters like terminal sequences, common separators like newline, etc. So does (gnu)
ls by the way, but here
ls is more tolerant. You can use the
-z flag to get the original names in a zero-terminated, machine-parsable format. Magit should use it (parsing escapes is more fragile), patch it if you can.