jenkinsci / jenkinsci/git-plugin

[JENKINS-41321] Add option for different refspec for polling and clone during build

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

Description

To speed up the build I want to use a refspec to only clone the needed branch like this:

refs/heads/$GIT_LOCAL_BRANCH:refs/remotes/$GIT_BRANCH

This seemed to work great at first, but then I found out this refspec is also used during polling.

This means that not all branches are being built anymore, even though our branch specifier is '**', because they are simply not fetched anymore.

This is why I would like to have an option to specify a different refspec for the build than for the polling. So I can have these refspecs:

polling: refs/heads/*:refs/remotes/*

building: refs/heads/$GIT_LOCAL_BRANCH:refs/remotes/$GIT_BRANCH

---
Originally reported by jeltef, imported from: Add option for different refspec for polling and clone during build


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

Raw content of original issue

To speed up the build I want to use a refspec to only clone the needed branch like this:
refs/heads/$GIT_LOCAL_BRANCH:refs/remotes/$GIT_BRANCH

This seemed to work great at first, but then I found out this refspec is also used during polling.
This means that not all branches are being built anymore, even though our branch specifier is '**', because they are simply not fetched anymore.

This is why I would like to have an option to specify a different refspec for the build than for the polling. So I can have these refspecs:
polling: refs/heads/*:refs/remotes/*
building: refs/heads/$GIT_LOCAL_BRANCH:refs/remotes/$GIT_BRANCH

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.