Check remote branch existence on sourcegraph remote, not origin
My team has a particular setup that currently isn't supported by this plugin. For various reasons, the HEAD branch of our sourcegraph remote is not the same as the HEAD branch of our origin. On origin, we use develop, and on sourcegraph we use master. If I'm on develop and try to open a link to Sourcegraph, the plugin confirms that develop exists on origin, but not that it exists on sourcegraph.
https://github.com/sourcegraph/sourcegraph-jetbrains/blob/c73b3800c39e90139b37eab01998ad8bc75477f1/src/Util.java#L101-L104
There are two assumptions in the above snippet that are not completely general:
-
The remote branch that matters may be
sourcegraphinstead oforigin(which is hard-coded inisRemoteBranch). -
The HEAD for the remote branch that matters may not be
master.
A fix for (1) solves for my team's specific circumstances. A fix for (2) would make this plugin more robust, but isn't as high of a priority.
I'm not sure the best way to implement the fix for (2). If you run git remote show sourcegraph you could grep for a line that reads HEAD branch: master. Maybe there's a better approach? Alternatively, add a simple branch setting to the .idea/sourcegraph.xml config file to override the assumption of master.