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.