Handle an upstream branch for an unborn one

Git branches are very precocious and they can have an upstream before they're born.

This fixes part of #2236 that actually breaks something.

/cc @jamill