- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
Major
 - 
    Jenkins 1.609.1, Git plugin 2.4.0, Git Client plugin 1.18.0, Centos 6
 
We have a project in several branches where just one branch is needed to build at a time. Some other branches contain a lot of unneeded data. The correct refspec is specified in the job's configuration. But when the job is run, Jenkins first downloads all the refs:
> /usr/bin/git -c core.askpass=true fetch --tags --progress **url here** +refs/heads/:refs/remotes/origin/ # timeout=30
Only then, after adding the remote and other operations, it uses the specified ref:
> /usr/bin/git -c core.askpass=true fetch --tags --progress **url here** +refs/heads/master:refs/remotes/origin/master # timeout=30
This leads to a big waste of time, as lots of data is actually downloaded but not used at all.
- is related to
 - 
                    
JENKINS-33140 Git plugin doesn't use refspec on the first clone/fetch
-         
 - Closed
 
 -         
 - 
                    
JENKINS-36507 git plugin 2.5.2 breaks builds which use a narrow refspec but expect all refs were fetched
-         
 - Closed
 
 -         
 
- relates to
 - 
                    
JENKINS-28516 refspec is not applied on clone (initial fetch)
-         
 - Closed
 
 -