Don't expect a remote "origin" if you're setting local REPOREFs

If one uses set-sources-vars -l $DIRNAME where $DIRNAME is a git
repository without a remote called "origin", it produces gibberish
output.

This fixes the get_name function so that it behaves correctly in
that instance.

Change-Id: I109315a776b3ab95ba75fe05399d487f6e0b3df8
Closes-bug: 1365022
Merge "Don't expect a remote "origin" if you're setting local REPOREFs"