bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
455 stars 98 forks source link

"Open in Browser" should have a fallback for local branches with no upstream #120

Open isgulkov opened 4 years ago

isgulkov commented 4 years ago

So, I run "GitHub: Open Remote URL in Browser" and get an error message that the branch I'm currently editing has no upstream configured. I mean, this is true, but the behaviour is not at all what I expected.

What you can do in this case is run git log and find literally the next best thing. In most cases by far, it would be good enough. In fact, I can't imagine a single case where a user wouldn't expect this to happen.

I'll certainly implement this myself, most likely as a patch for this plugin, but let me know (in the comments to this) if you want the PR.

bgreenlee commented 4 years ago

Hmm, that’s a tricky one. What if the file you’re on doesn’t exist on whatever branch (master?) you might open on remote? There is already a Open Remote URL in Browser (master) command. Is that sufficient?

bgreenlee commented 4 years ago

I guess ideally you’d show an error dialog saying there’s no upstream branch and ask if they want to open master or \<select other branch> instead, but the UI options are pretty limited in Sublime.