Patch Set 2:

This patch set addresses most of Shawn's comments. The case with the pull command is handled by adding another list of refs.

The TODO about shortenRefName is still open though. Shawn, can you decide what we should do there?