When pulling from git, need to ignore commit hooks
Created originally on Bitbucket by nikratio (Nikolaus Rath)
I have defined some commit hooks to avoid committing eg. whitespace-only changes. However, it seems that these commit hooks also prevent me from cloning a git repository containing such commits:
#!text
$ hg clone git://git.debian.org/git/users/goedson/pkg-gnotime.git
destination directory: pkg-gnotime
Counting objects: 1486, done.
Total 1486 (delta 912), reused 1432 (delta 884)
importing git objects into hg
AUTHORS
[...]
xmldocs.make
calling hook pretxncommit.checkfiles: <function check_hook at 0x7f5b0adad5f0>
checkfiles: checking commit for tabs or trailing whitespace...
doc/C/gnotime.xml: trailing whitespace in @@ -0,0 +1,1132 @@
doc/C/gnotime.xml: trailing whitespace in @@ -0,0 +1,1132 @@
[...]
checkfiles: src/xml-write.c: whitespace_begin whitespace_end
checkfiles: 19432 issues(s) found in 126 file(s) in 367890589ca3
transaction abort!
rollback completed
abort: pretxncommit.checkfiles hook failed
I assume this is because hg-git is internally using regular hg commits to "pull" the changesets from the git repository. I think that for these commits, any commit hooks should be ignored.
Edited by Dan Villiom Podlaski Christiansen