Fix remote URL handling

* list() was missing a 'cd' into the repo directory.
* git-symbolic-ref's --short option is fairly recent and should be
  avoided for now.
* Remote URL code was factored out into a separate function.