[JENKINS-65032] Add option to include merge commits in changelogs
Testing done
- Added new tests
Added features
- Option to Include merge commits in the changelog
Required changes
- CliGit implementation changelog format was reverted from custom format to
--format=raw. - Since CliGit implementation was reverted to use
rawformat the date format was changed to default (unix time).
In the past, changelog format for CliGit implementation was changed to custom format because of the git-plugin date parsing issue (https://issues.jenkins.io/browse/JENKINS-27097). Since then git-plugin date parsing has been updated: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitChangeSet.java#L282-L300
Currently following custom changelog format is used:
/** Equivalent to the git-log raw format but using ISO 8601 date format - also prevent to depend on git CLI future changes */
public static final String RAW =
"commit %H%ntree %T%nparent %P%nauthor %aN <%aE> %ai%ncommitter %cN <%cE> %ci%n%n%w(0,4,4)%B";
Unfortunately, the above custom format is not equivalent to git-log raw format since all parent commits are placed on a single line:
parent sha1 sha2 ...
Although expected output is:
parent sha1
parent sha2
Existing JGit implementation places each parent commit on a separate line so there is inconsistency between CliGit and JGit implementations. Because of that additional changes were required.
Submitter checklist
- [x] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [x] Link to relevant issues in GitHub or Jira
- [x] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue
Note that this was requested before but the PR was not merged. I would also like to include merge commits but my preference would be to simply use git log instead of git whatchanged for CliGitAPIImpl (no hablo how to implement for JGit).
https://github.com/jenkinsci/git-client-plugin/pull/237