jenkinsci / jenkinsci/git-plugin

[JENKINS-19569] Git polling builds even when includes section doesn't include the changes

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

Description

Some of my builds have an include of a single file

scripts/test.sh

I have fast remote polling enabled. I also hit this issue with fast remote polling off. I can check in something on a branch in the scripts2 dir, and the job which is monitoring scripts/test.sh will still run. The polling log shows changes. And the changes are shown as only the files changed in the scripts2 dir.

It does correctly skip running the job when I have no remote refs, so :

git ls-remote http://githq/releng.git master

3b3a4479be16c88ee3f8b51b5995474b6516c17f refs/heads/master

But on my other repo I get

git ls-remote http://githq/bigger.git master

0e144203fe6876612f70dba2315b92f78070c8f8 refs/heads/master

d63653727dc58d1d79956b665c27442b58df7c82 refs/remotes/origin/master

In addition, the git-plugin looks like it is polling both heads and remote refs, line 104 in the GitSDMSource.java

return Arrays.asList(new RefSpec("+refs/heads/:refs/remotes/origin/"));

Looks like it polls my ref/remotes, which is way out of date compared to the head, which means something will be triggered. I'm trying to change the plugin, or see if I can update the remote ref to see if that fixes things, but right now I haven't been able to do either one. I also am not sure I am even looking at the right spot.

---
Originally reported by aflat, imported from: Git polling builds even when includes section doesn't include the changes


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): git-plugin-PathRestriction
  • resolution: Unresolved
  • votes: 6
  • watchers: 8
  • imported: 2025-12-02

Raw content of original issue

Some of my builds have an include of a single file

scripts/test.sh

I have fast remote polling enabled. I also hit this issue with fast remote polling off. I can check in something on a branch in the scripts2 dir, and the job which is monitoring scripts/test.sh will still run. The polling log shows changes. And the changes are shown as only the files changed in the scripts2 dir.

It does correctly skip running the job when I have no remote refs, so :

git ls-remote http://githq/releng.git master
3b3a4479be16c88ee3f8b51b5995474b6516c17f refs/heads/master

But on my other repo I get

git ls-remote http://githq/bigger.git master
0e144203fe6876612f70dba2315b92f78070c8f8 refs/heads/master
d63653727dc58d1d79956b665c27442b58df7c82 refs/remotes/origin/master

In addition, the git-plugin looks like it is polling both heads and remote refs, line 104 in the GitSDMSource.java

return Arrays.asList(new RefSpec("+refs/heads/:refs/remotes/origin/"));

Looks like it polls my ref/remotes, which is way out of date compared to the head, which means something will be triggered. I'm trying to change the plugin, or see if I can update the remote ref to see if that fixes things, but right now I haven't been able to do either one. I also am not sure I am even looking at the right spot.

environment

```
git plugin 1.5.0

Jenkins ver. 1.525
```

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.