jenkinsci / jenkinsci/git-plugin

[JENKINS-64424] Incorrect behavior of notifyCommit for regex branch spec with $

Open
#3,627 0 comments 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

Jenkins 2.270

git-plugin 4.5.0

I have a freestyle project with such config:

Repository URL: git@​mygitserver.com:my-repo

Branches to build: **

Build Triggers > Poll SCM is enabled

When I send a notification on http://jenkins/git/notifyCommit - everything works as expected:

```
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled project

```

When I change branch specifier to a simple regex :.* - everything still works, but when I use end of line sign like :.+foo$ the behavior changes:

```
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled polling of project

```

Instead of staring new build Jenkins schedules polling of the project and if there are no new commits there will be no build scheduled. I think it's a bit strange that different regex-s lead to different building algorithms. IMHO algorithms should be the same for all regex-s.

This situation connected somehow with Parametrized builds, JENKINS-29574 and this code.

I can try to fix it if someone describe expected behavior with Parametrized builds. Is it possible to use parameters with regex branch spec? Should git-plugin check if branch spec is a regex before searching for parameters?

---
Originally reported by goganchic, imported from: Incorrect behavior of notifyCommit for regex branch spec with $


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

Raw content of original issue

Jenkins 2.270
git-plugin 4.5.0

I have a freestyle project with such config:
Repository URL: git@mygitserver.com:my-repo
Branches to build: **
Build Triggers > Poll SCM is enabled

When I send a notification on http://jenkins/git/notifyCommit - everything works as expected:



$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"

Scheduled project


When I change branch specifier to a simple regex :.* - everything still works, but when I use end of line sign like :.+foo$ the behavior changes:



$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"

Scheduled polling of project


Instead of staring new build Jenkins schedules polling of the project and if there are no new commits there will be no build scheduled. I think it's a bit strange that different regex-s lead to different building algorithms. IMHO algorithms should be the same for all regex-s.

This situation connected somehow with Parametrized builds, JENKINS-29574 and this code.

I can try to fix it if someone describe expected behavior with Parametrized builds. Is it possible to use parameters with regex branch spec? Should git-plugin check if branch spec is a regex before searching for parameters?

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.