tyru / open-browser-github.vim

Open GitHub URL of current file, etc. from Vim editor (supported GitHub Enterprise)
BSD 3-Clause "New" or "Revised" License
173 stars 14 forks source link

Add a new g:openbrowser_github_always_use_upstream_commit_hash option #43

Closed vmiklos closed 1 year ago

vmiklos commented 1 year ago

I regularly hit 404 errors on GitHub with OpenGithubFile because I have some local commits around, which are not yet pushed anywhere.

The benefit of linking to commits is that line references work later (when the code gets changed on a branch), so that's wanted. At the same time, some worflows mean that you typically have small local commits, so even if the line numbers work give correct results, the opened link doesn't work, as it tries to look up a local hash, not the upstream hash.

Fix the problem by adding a new 'always_use_upstream_commit_hash' option (disabled by default), so in case it's known that the line numbers will work in practice (consider a large codebase, and only a few, small local commits), then this way we can get working URLs.

This is disabled by default, since in case there are many large commits and the inspected part of the file is different locally vs upstream, then this will give garbage results, so it's not safe in general.

vmiklos commented 1 year ago

@tyru could you please review this? I used to have a separate checkout just to have this plugin working and today I realized that if I work with the upstream hash, then I can use it from my normal checkout as well. :-) Thanks.

vmiklos commented 1 year ago

@tyru could you please comment on this? Thanks!

vmiklos commented 1 year ago

@tyru could you please review this? Thanks!

vmiklos commented 1 year ago

@tyru does this look good to you? Thanks:-)

vmiklos commented 1 year ago

@tyru ping, could you please review this? Thanks!

vmiklos commented 1 year ago

@tyru can I help somehow to get this in? Thanks.

vmiklos commented 1 year ago

@tyru friendly ping :-)

vmiklos commented 1 year ago

Giving up on this for now, just le me know if you want me to re-open this. Thanks.