Skip to content

Conversation

@markrian
Copy link

@markrian markrian commented Oct 8, 2020

When the current branch tracks an upstream branch, generate a link to
that upstream branch (or SHA) rather than using the local one, since it
may not exist upstream.

In the case that the local branch has no upstream, prompt the user for
the branch name to generate a link for.

Partly addresses #10.

Co-authored-by: souldzin [email protected]

When the current branch tracks an upstream branch, generate a link to
that upstream branch (or SHA) rather than using the local one, since it
may not exist upstream.

In the case that the local branch has no upstream, prompt the user for
the branch name to generate a link for.

Partly addresses ruanyl#10.

Co-authored-by: souldzin <[email protected]>
@markrian
Copy link
Author

markrian commented Oct 8, 2020

@souldzin and I worked on this last week. It's preliminary, e.g., there are no additional tests for this, hence the draft status.

The main goal was to avoid generating a 404 link in the case that the current HEAD commit doesn't exist on the remote (which, for me, is the case the majority of the time).

Some other possible approaches that might be better:

  1. Expose this functionality via a different command, e.g., :GHPreferRemote
  2. Add a g:gh_prefer_remote variable, default disabled, to enable this behaviour
  3. Replace this via a g:gh_ref_command variable, which is a command/script which gets the ref to use to build the link. For example, this could be used to get the latest tag, or find the "nearest" commit that exists on the remote. I quite like this approach, since it makes the heuristic completely user-configurable!

I'd really appreciate any thoughts on how to carry this forward! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant