git-changelog-maven-plugin
git-changelog-maven-plugin copied to clipboard
Question: Only Merge Commits should be logged
Hi,
I m searching for a solution for following requirement. I would like to log ONLY log Commits starting with Merge Branch between to git references.
I ve tried out your maven plugin and it seems it works in default setting the other way around. only log Commits NOT starting with Merge Branch..
Do you have a configuration option to change this default behaviour ?
<ignoreCommitsIfMessageMatches>"^(?!Merge).+"</ignoreCommitsIfMessageMatches>
does not work.. :-(
Thanks a lot for your support in advance.
I'd like to see this too. I'll investigate and issue a PR if I get it implemented.
@vhochstein have you tried
<ignoreCommitsIfMessageMatches>"^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*"</ignoreCommitsIfMessageMatches>
That should override the default which omits merge commits.
If I configure this plugin like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>se.bjurr.gitchangelog</groupId>
<artifactId>git-changelog-maven-plugin-example</artifactId>
<name>git-changelog-maven-plugin-example</name>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
<changelog.version>1.65-SNAPSHOT</changelog.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>se.bjurr.gitchangelog</groupId>
<artifactId>git-changelog-maven-plugin</artifactId>
<version>${changelog.version}</version>
<executions>
<execution>
<id>GenerateGitReleasenotes11</id>
<phase>generate-sources</phase>
<goals>
<goal>git-changelog</goal>
</goals>
<configuration>
<file>changelog-ignore-merge.md</file>
<fromRef>git-changelog-maven-plugin-1.61</fromRef>
<toRef>git-changelog-maven-plugin-1.62</toRef>
<ignoreCommitsIfMessageMatches>^(?!Merge).*</ignoreCommitsIfMessageMatches>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I get:
# Git Changelog Maven plugin changelog
Changelog of Git Changelog Maven plugin.
## git-changelog-maven-plugin-1.62
### GitHub [#18](https://github.com/tomasbjerre/git-changelog-maven-plugin/pull/18) Add extendedVariables property
**Merge pull request #18 from djn72/master**
* Add extendedVariables property
[b5d8cb431274f5f](https://github.com/tomasbjerre/git-changelog-maven-plugin/commit/b5d8cb431274f5f) Tomas Bjerre *2020-08-05 04:42:36*
And the commits between these tags are:
* 6e2f4a4 - (tag: git-changelog-maven-plugin-1.62) [maven-release-plugin] prepare release git-changelog-maven-plugin-1.62 (5 månader sedan) <Tomas Bjerre><Tomas Bjerre>
* e45432e - openjdk8 (5 månader sedan) <Tomas Bjerre><Tomas Bjerre>
* b5d8cb4 - Merge pull request #18 from djn72/master (5 månader sedan) <Tomas Bjerre><GitHub>
|\
| * e682c28 - Add extendedVariables property (5 månader sedan) <David Nicklin><David Nicklin>
|/
* 1e91537 - [maven-release-plugin] prepare for next development iteration (1 år, 1 månad sedan) <Tomas Bjerre><Tomas Bjerre>
* e54b9f3 - (tag: git-changelog-maven-plugin-1.61) [maven-release-plugin] prepare release git-changelog-maven-plugin-1.61 (1 år, 1 månad sedan) <Tomas Bjerre><Tomas Bjerre>
But I think the better solution would be to use the merge
boolean that is available in the context of the commit, as documented here: https://github.com/tomasbjerre/git-changelog-lib
I solved my issue as follows
<ignoreCommitsIfMessageMatches>^(Release|Merge remote-tracking).+</ignoreCommitsIfMessageMatches>
and in my template:
`{{#commits}} {{#merge}}
- "{{{messageTitle}}}" {{/merge}} {{/commits}}`