Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337801 - on clone create '.git/hooks' folder
Summary: on clone create '.git/hooks' folder
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 0.12   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-22 05:00 EST by Edwin Kempin CLA
Modified: 2019-03-26 10:26 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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