Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337801

Summary: on clone create '.git/hooks' folder
Product: [Technology] JGit Reporter: Edwin Kempin <edwin.kempin>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: caniszczyk, santoshkumar.v, sop
Version: 0.12   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Edwin Kempin CLA 2011-02-22 05:00:51 EST
When a repository is cloned with JGit (EGit) there is no 'hooks' folder under the repository's '.git' folder. Since hooks are not supported yet (?) this is not an issue, but it gets annoying if you use this repository also from the normal Git command line (e.g. msysgit) and you want to install the commit hook from Gerrit to automatically generate Change-ID's.
The Gerrit documentation [1] provides the following command to install the commit hook: 
scp -p -P 29418 review.example.com:hooks/commit-msg .git/hooks/
e.g.: scp -p -P 29418 edwin.kempin@review.source.android.com:hooks/commit-msg .git/hooks/

This command copies the 'commit-msg' file from Gerrit into the '.git/hooks/' folder. However if the '.git/hooks/' folder does not exist, the command instead creates a file '.git/hooks' which has the content of the 'commit-msg' file. Then the hook is of course not working.

I guess the easiest way to avoid this problem would be to simply create an empty '.git/hooks' folder on clone.

[1] https://review.source.android.com/Documentation/user-changeid.html#creation
Comment 1 Chris Aniszczyk CLA 2011-02-22 09:38:51 EST
This sounds reasonable.
Comment 2 Shawn Pearce CLA 2011-02-22 10:39:32 EST
Fixed in http://egit.eclipse.org/r/2566