Enable use of local reference directories

*If* you already have on-disk local copies of the repos you're cloning,
using them as a reference can be a significant time and bandwidth
saving.

If you don't already have them, then *shrug* you're gonna have to use
the network. If your local repo is stale, I'm told git is Teh Clever and
will pull the missing refs from the network.
Merge branch 'use-reference' into jp-master
Only match on full branch name

branches is a multi-line string, so 'in' is doing a substring match.

If there's an existing branch called "rollup_1_2" and branch_name is
"rollup_1", "branch_name in branches" will return true. This cause a
failure a few lines later when we try to "get checkout rollup_1" but
that branch doesn't exist

This change adds a newline into the string we're matching against to
make sure we only match against the full name of a branch rather than
just the start of the branch name.