[JENKINS-45447] Improve poll and checkout performance for repos with many tags
[JENKINS-45447] Improve poll and checkout performance for repos with many tags

JENKINS-45447 reports that checkout of a repository with many tags
from a freestyle job using a wildcard in the branch name is
dramatically slower than earlier releases.  Many other cases which use
the advanced branch selection mechanism show the same performance
problem.

31fedce9c added tag checks to the evaluation loop for branch
names. Unfortunately, tag evaluation needs both the tag name and the
SHA1 of the commit identified by the tag. The original; implementation
called revParse() to compute that SHA1 for each tag. With many tags in
the repository (bug report example was 60,000 tags), the checkout time
increased dramatically.

I found that even the number of tags in the git plugin repository
could add as much as 5 seconds for the computation of SHA1 hashes.
Those computed SHA1 hashes were then immediately discarded because
they did not satisfy the branch name selection criteria.

Calling GitClient.getTags() returns more information than
GitClient.getTagNames(), so it is possible that this change is still
not fast enough.

MarkEWaite/git-plugin,MarkEWaite/git-plugin,jacob-keller/git-plugin,v1v/git-plugin,MarkEWaite/git-plugin,MarkEWaite/git-plugin,jenkinsci/git-plugin,martinda/git-plugin,martinda/git-plugin,jacob-keller/git-plugin,jenkinsci/git-plugin,v1v/git-plugin,jenkinsci/git-plugin,v1v/git-plugin,jenkinsci/git-plugin,jacob-keller/git-plugin,martinda/git-plugin