jenkinsci/git-plugin — pull request #234 by blt04 (2014-06-08 19:35:03+00:00)
Title: Fix multiple repository bugs

This PR fixes a few bugs and adds improvements when using multiple repositories (multiple forks of the same repo, not MultiSCM):

1. Fix bug when building tags (previously tags failed to build with multiple repositories)
2. Properly detect changes when changing branch between builds
3. Use *single branch* mode when specifying a single branch in a single remote
4. Fix bug when polling tags (previously polling always detected changes when branch spec was a tag).

We use git-plugin's multiple repository support to build different user forks of the same repository. Users specify the branch to build via a build parameter, like `remotes/myfork/master`. Previously the above bugs forced us to use separate build jobs for each fork.

This PR does two main things:

1. Adds support for using *single branch mode* with multiple repositories. Previously single branch mode only worked if you only had one repository. But users can still specify a single branch when multiple repositories are configured (e.g. `remotes/origin/master`). This is often the case when using a build parameter to specify the branch. This PR refactors single branch mode to support multiple repositories where applicable. Without this or #233 builds failed to detect the branch properly when using a fully qualified branch name (e.g. branch with `remotes/` in it).

2. Fixes tag support. Building tags with multiple repositories configured was broken. This uses single branch mode to build tags if the user uses a fully qualified branch name (e.g. `refs/tags/mytag`). If an unqualified tag is given, the `getAdvancedCandidateRevisions` method now supports tags as well. Finally, we force workspace polling because currently [git-client-plugin](https://github.com/jenkinsci/git-client-plugin.git) does not provide a way to query tags without a workspace.