Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

git - Egit hooks do not get triggered

I have a git repo with a pre-commit hook that intentionally fails 100% of the time.

cat .git/hooks/pre-commit
> exit 1

If I try to commit through the command line, it fails as expected. However, if I commit from egit, the hook is ignored and the changes get committed.

Does egit/jgit not recognize hooks yet? Is there a workaround for this?

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

(Original answer: June 2011)

MatrixFrog correctly points out to the bug 299315, which mentions those hooks aren't supported yet.

You also can explore the JGit repository, now on GitHub, which doesn't show any commit about hooks.
And you can search for 'hook' in the EGit User Guide: the notion of hook isn't mentioned either.


Update March 2015 (4 years later): as MariuszS points out in the comments, "hook" is present in JGit.

In 2015, there are works in progress to support those hooks:

Those should be in the upcoming JGit 3.7


Update Q4 2015, EGit 4.x does support hooks, as mentioned in this answer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...