Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Only Merge Commits should be logged #20

Open
vhochstein opened this issue Dec 7, 2020 · 4 comments
Open

Question: Only Merge Commits should be logged #20

vhochstein opened this issue Dec 7, 2020 · 4 comments

Comments

@vhochstein
Copy link

vhochstein commented Dec 7, 2020

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.

@jconnolly
Copy link

I'd like to see this too. I'll investigate and issue a PR if I get it implemented.

@jconnolly
Copy link

@vhochstein have you tried

<ignoreCommitsIfMessageMatches>"^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*"</ignoreCommitsIfMessageMatches>

That should override the default which omits merge commits.

@tomasbjerre
Copy link
Owner

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

@vhochstein
Copy link
Author

vhochstein commented Jan 12, 2021

I solved my issue as follows
<ignoreCommitsIfMessageMatches>^(Release|Merge remote-tracking).+</ignoreCommitsIfMessageMatches>

and in my template:

`{{#commits}}
{{#merge}}

  • "{{{messageTitle}}}"
    {{/merge}}
    {{/commits}}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants