jenkinsci / jenkinsci/git-plugin

[JENKINS-64656] Polling: Pattern for excluded messages doesn't match due to final line break

Open
#3,632 1 comment 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description


  1. add a message "Polling ignores commits with certain messages"

    .*\[maven-release-plugin\].*


  1. commit with this message - polling doesn't ignore the message

  2. Reason: the commit message string contains a final line break (commits I created locally, commits that are created on Jenkins host with CentOS)

  3. Analysis: I added some lines with listener.getLogger().println("[ABC] ...") to src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java

  4. Polling Log showed me that the message contains a line break that doesn't match with pattern - empty line in polling log:

      [ABC] Checking commit 4b22f7aacbf22359c46adbdf20b04c09cf8b890e: Found message [maven-release-plugin]

    [ABC] >> excludedMessage: [.*\[maven-release-plugin\].*]
    [ABC] >>>> Pattern IS set: .*\[maven-release-plugin\].*
    [ABC] >> acceptedMessage: [[maven-release-plugin]
    ]



  1. Fix: I changed the following line in src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java:

      // old line that doesnt ignore the message
    
    excludedPattern = Pattern.compile(excludedMessage);
    // new line that works with the final line break
    excludedPattern = Pattern.compile(excludedMessage, Pattern.DOTALL);

As I'm not a software developer, I'm not sure about side effects when adding Pattern.DOTALL to the code line I mentioned - but it works for me with simple patterns like .[maven-release-plugin].

---
Originally reported by carstensteinchen, imported from: Polling: Pattern for excluded messages doesn't match due to final line break


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue


  1. add a message "Polling ignores commits with certain messages"

    .*\[maven-release-plugin\].*



  1. commit with this message - polling doesn't ignore the message

  2. Reason: the commit message string contains a final line break (commits I created locally, commits that are created on Jenkins host with CentOS)

  3. Analysis: I added some lines with listener.getLogger().println("[ABC] ...") to src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java

  4. Polling Log showed me that the message contains a line break that doesn't match with pattern - empty line in polling log:

      [ABC] Checking commit 4b22f7aacbf22359c46adbdf20b04c09cf8b890e: Found message [maven-release-plugin]

    [ABC] >> excludedMessage: [.*\[maven-release-plugin\].*]
    [ABC] >>>> Pattern IS set: .*\[maven-release-plugin\].*
    [ABC] >> acceptedMessage: [[maven-release-plugin]
    ]




  1. Fix: I changed the following line in src/main/java/hudson/plugins/git/extensions/impl/MessageExclusion.java:

      // old line that doesnt ignore the message
    
    excludedPattern = Pattern.compile(excludedMessage);
    // new line that works with the final line break
    excludedPattern = Pattern.compile(excludedMessage, Pattern.DOTALL);


As I'm not a software developer, I'm not sure about side effects when adding Pattern.DOTALL to the code line I mentioned - but it works for me with simple patterns like .[maven-release-plugin].

  • environment: GIT Plugin 4.5.2, Jenkins 2.222.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.