Bug 439346 - Configure jgit to always include gerrit ChangeId in generated commits.
Summary: Configure jgit to always include gerrit ChangeId in generated commits.
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: 3.5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-10 09:40 EDT by Christophe Thiebaud CLA
Modified: 2014-07-11 05:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Thiebaud CLA 2014-07-10 09:40:58 EDT
Background : 

We are using the jgitflow maven plugin (version 1.0-m3) [1], which in turn uses jgit (version 3.3.1.201403241930-r) [2].
 
All commits generated for us by jgitflow MUST contain the gerrit changeID [3], as these commits will enter the gerrit dance later.

jgitflow uses CommitCommand [4] and MergeCommand [5] jgit API.

Although the CommitCommand class has a 'insertChangeId' attribute (which defaults to false), there is no mean to have this insertChangeId set to true with some external configuration, i.e., without changing the jgitflow maven plugin sources.

Worst, in MergeCommand, there seems to be no way to include a gerrit changeID in the merge commit generated.

Proposal (copied verbatim from suggestions by Matthias Sohn in a mail exchange): 

« There is a custom git configuration option gerrit.createChangeId defined in JGit's ConfigConstants [6]. Though at the moment it's used by EGit only. So if jgitflow doesn't call the corresponding setter there is no way to configure that at the moment. (...) we could consider teaching CommitCommand to directly respect this configuration option if it's set in git configuration. (...) we should also enhance MergeCommand to support setting changeId similarly to CommitCommand »

Thanks
Christophe

[1] https://bitbucket.org/atlassian/jgit-flow/wiki/Home
[2] https://bitbucket.org/atlassian/jgit-flow/src/f78e05f8167357c7bc38a23db3f8c42a9a7fe475/pom.xml?at=develop
[3] http://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html
[4] https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
[5] https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
[6] https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java#L192