[Fix JENKINS-20286] JGit builds at every poll unless local workspace is used

The JGit getHeadRev(url, branch) implementation was different enough
from the CliGit implementation that it was not finding the passed in
branch name if the branch name included a slash or any wildcard.

The CliGit implementation relies on the command line git internal
implementation of file name pattern matching to expand branch names like
"master*".  The JGit implementation converts the user supplied file name
pattern into a regular expression and then applies the regular expression
to the strings returned from the lsRemoteRepository() call.

The previous implementation created a dummy repository in cases where
the remoting API expected a dummy repository.  The new implementation
of getHeadRev does not create a dummy repository.

This passes unit tests, but has not been verified by interactive testing.
Please do not pull this into the official repository until this comment
about interactive testing has been removed.
Merge remote-tracking branch 'origin/master-fix-JGit-getHeadRev' into master-work