On Tuesday, November 12, 2013 5:11:40 PM UTC+1, Gabby Romano wrote:
> Hi All,
> I would like to be able to prevent case name changes done on windows
> clients and being pushed to our linux remote repository. when pulled, it
> confuses the other windows clients and messes things up. I want to use a
> hook for that along with the rename detection mechanism of git, if I can
> call it this way.
> my question is - what would be the best way to approach this in the hook ?
> detect the rename and check the content is the same (sha1 check ? )
If someone changes the contents of the file as well as renaming it, I guess
the sha1 check wouldn't work.
How about parsing the output of `git status` in a pre-commit hook and
checking whether the same filename string appears twice, ignoring case?
I'm not on a Windows machine, so I can't really test this. I'm on some OSX
semi-case insensitive system where changing the casing of a filename
doesn't even register in Git. I need to first `git rm` the file, create the
new one with the same contents and stage it in order to see the rename:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
# renamed: pom.xml -> POM.xml
As soon as I do `git reset`, the change is gone. Quite funny. Anyhow, I'm
not sure how all these corner cases will work out on your filesystem. Best
thing is probably to start playing around with it.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/groups/opt_out.