Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Minor
-
Resolution: Not A Defect
-
Component/s: git-client-plugin
-
Labels:
-
Environment:Git client plugin: 1.16.1
Git plugin: 2.3.4
-
Similar Issues:
Description
I have the "refspec" empty so git plugin fetches all remote branches as documented. We are only interested in building origin/master (but we need the other branches around for the build).
I am trying to put in the branch settings things like "refs/remotes/origin/master" or just "origin/master" but whatever I type in is ignored and some other remote branch gets built. It seems like whatever gets typed in in that input box has no effect whatsoever. Even if I type a reference that does not exists like "ref/foo/bar", it will (a) not give an error, and (b) check the same random branch. Here is a console output that demonstrates:
Started by user User (user) Building in workspace /var/lib/jenkins/jobs/continuous_test/workspace > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url ssh://jenkins2@gerrit.domain.com:29418/Collectr.git # timeout=10 Fetching upstream changes from ssh://jenkins2@gerrit.domain.com:29418/Collectr.git > git --version # timeout=10 > git -c core.askpass=true fetch --tags --progress ssh://jenkins2@gerrit.domain.com:29418/Collectr.git +refs/heads/*:refs/remotes/origin/* > git rev-parse FETCH_HEAD^{commit} # timeout=10 Checking out Revision 02a1ad8196306911dd4ee6749326c69d549c4cba (refs/foo/bar)
Notice the "refs/foo/bar" at the end? It always checkouts the same commit, no matter what branch I give it.
Hmm. Minutes after submitting this I realized that the "Strategy" of the build was "Gerrit", when I changed it to "Default" it started working correctly.
Feel free to close. However, the line that it says it is checking out the branch with the name I've given (but a different commit) got me side tracked. I think the behavior of the plugin could be improve by saying that this option is ignored when a non-default strategy is chosen.