Open markrian opened 3 years ago
@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:
:GHPreferRemote
g:gh_prefer_remote
variable, default disabled, to enable this behaviourg: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! 🙇
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 https://github.com/ruanyl/vim-gh-line/issues/10.
Co-authored-by: souldzin souldzin@souldzin.com