Please drop the `goto ok` stuff in favor of something like:

```c
if (git_reference_is_branch(ref)) {
  ...
} else if (git_reference_is_remote(ref)) {
  ...
} else {
  // set error
}

// success
```