jenkinsci / jenkinsci/git-plugin

[JENKINS-66473] "Polling ignores commits in certain paths" doesn't work in combination with "Shallow clone"

Open
#3,677 2 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

In the Source Code Management section of a Jenkins job configuration, if you select Git and configure the two additional behaviors "Polling ignores commits in certain paths" and "Shallow clone", then the job is triggered by commits that should be ignored based on their paths.

To reproduce:



  1. Create a new freestyle Jenkins job.

  2. In the Source Code Management section of the configuration, specify Git. In the Repository URL field, specify the URL of some Git repository.

  3. In the Additional Behaviours subsection, select "Polling ignores commits in certain paths", and enter some path constraint in the Included Regions field, such as someDir/.*.

  4. Also in the Additional Behaviours subsection, select "Advanced clone behaviours", select the "Shallow clone" checkbox, and enter a shallow clone depth of 1.


  5. In the Build Triggers section, select the "Poll SCM" checkbox and enter the schedule * * * * * (meaning poll every minute).

  6. Save the configuration. Wait for some commits to the Git repository. Observe that the job is triggered by every commit to any part of the repository – not just ones whose paths match the Included Regions pattern.

More generally, it seems to be that, if your "shallow clone depth" is some number n, then, if there have been at least n commits to the entire repository since the last build, the job is triggered regardless of whether the commits are to ignored regions.

---
Originally reported by ben_g, imported from: "Polling ignores commits in certain paths" doesn't work in combination with "Shallow clone"


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

Raw content of original issue

In the Source Code Management section of a Jenkins job configuration, if you select Git and configure the two additional behaviors "Polling ignores commits in certain paths" and "Shallow clone", then the job is triggered by commits that should be ignored based on their paths.

To reproduce:



  1. Create a new freestyle Jenkins job.

  2. In the Source Code Management section of the configuration, specify Git. In the Repository URL field, specify the URL of some Git repository.

  3. In the Additional Behaviours subsection, select "Polling ignores commits in certain paths", and enter some path constraint in the Included Regions field, such as someDir/.*.

  4. Also in the Additional Behaviours subsection, select "Advanced clone behaviours", select the "Shallow clone" checkbox, and enter a shallow clone depth of 1.

  5. In the Build Triggers section, select the "Poll SCM" checkbox and enter the schedule * * * * * (meaning poll every minute).

  6. Save the configuration. Wait for some commits to the Git repository. Observe that the job is triggered by every commit to any part of the repository – not just ones whose paths match the Included Regions pattern.

More generally, it seems to be that, if your "shallow clone depth" is some number n, then, if there have been at least n commits to the entire repository since the last build, the job is triggered regardless of whether the commits are to ignored regions.

environment

```
Jenkins 2.263.3

Git plugin 4.8.2
```

1 attachment

- [shallow-clone_polling-ignores.png](https://issues.jenkins.io/secure/attachment/56247/shallow-clone_polling-ignores.png)
> ![shallow-clone_polling-ignores.png](https://issues.jenkins.io/secure/attachment/56247/shallow-clone_polling-ignores.png)

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.