Monorail Project: gerrit Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 4841 GIT_DIR not filled in for ref-update hooks with the new hooks-plugin.
Starred by 2 users Reported by christia...@esrlabs.com, Oct 31 2016 Back to list
Status: Released
Owner: ----
Closed: Nov 2



Sign in to add a comment
Affected Version: 2.13.2

What steps will reproduce the problem?
0. I built gerrit with its plugins from source using the 2.13.2 tag.
1. Install hooks core plugin, add a ref-update hook e.g. shell script that just prints the env and exits with 1.
2. Push a commit.
3. The env (printed in the git-client) does not contain an environment variable with GIT_DIR.

What is the expected output?
GIT_DIR set to the project that is pushed to

What do you see instead?
Some debug output in the plugin showed me that in HookTask projectName is null although the hookArgs contain --project example.

Please provide any additional information below.

 
I added the lines:
log.error("projectName: '" + projectName);
log.error("hookargs: '" + args);
before the if (projectName != null) test in HookTask.java.

this gives the described output.

Patch for CommitReceived, that adds the project name to the run call of the hook.
The project name is calculated by using toString on a ProjectNameKey-object. Not sure if this is the way to go.
0001-Added-project-name-to-commit-received-hook.patch
1.2 KB Download
I opened up review https://gerrit-review.googlesource.com/#/c/90551/ for this.
Project Member Comment 4 by huga...@gmail.com, Nov 1
Status: ChangeUnderReview
https://gerrit-review.googlesource.com/#/c/90570/
Labels: FixedIn-2.13.3
Status: Submitted
Status: Released
Sign in to add a comment