I have a repository that has windows (cp1252) and linux (utf8) committers. Obviously Git gets confused, and puts invalid (from linux's perspective) filenames. I know I can use hooks to rename the files in one side (on linux's side, for instance, renaming the files from cp1252 to utf8 when they come and the reverse when they go), but ... exactly how do I do that? Exactly which hooks I have to write?
+2
A:
Good question!
http://www.serverwatch.com/tutorials/article.php/3705216 Talks about a tool called "convmv" which will fix filenames. This might be helpful.
Iconv http://www.gnu.org/software/libiconv/ can convert arbitrary text into different character sets.
http://ozmm.org/posts/git_post_commit_for_profit.html Tells you how to go about making a post-commit hook, more Ruby-specific though. It looks like you just add a script to execute in .git/hooks/post-commit, and git will run it after you commit. It could be a script that even runs a script in your git repo.
For the script, I would recommend just scanning with find, convert the filename to UTF-8, see if it's already that name, and if not, move it.
Colin Curtin
2009-03-25 22:23:52
but is post-commit the right hook? I was thinking I had to convert (on linux) from cp1252 to utf8 after receiv files aingnd back to cp1252 before commiting or comparing files to the other repository (as linux machines are a minority in the network -- and convmv is easily installable in *buntu)...
Massa
2009-03-25 23:32:19