Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - dealing with mixed encoding filenames

Tags:

git

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?

like image 754
Massa Avatar asked Mar 25 '09 17:03

Massa


1 Answers

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.

like image 73
Colin Curtin Avatar answered Oct 18 '22 22:10

Colin Curtin