Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Check remote branch existence on sourcegraph remote, not origin #15

Closed
logan opened this issue Jun 11, 2020 · 0 comments
Closed

Check remote branch existence on sourcegraph remote, not origin #15

logan opened this issue Jun 11, 2020 · 0 comments

Comments

@logan
Copy link

logan commented Jun 11, 2020

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.

// If on a branch that does not exist on the remote, use "master" instead.
if (!isRemoteBranch(branch, repoRoot)) {
branch = "master";
}

There are two assumptions in the above snippet that are not completely general:

  1. The remote branch that matters may be sourcegraph instead of origin (which is hard-coded in isRemoteBranch).

  2. 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants