Skip to content

JetBrains: Fix up GitUtil

Administrator requested to merge dv/jetbrains-fix-open-on-sourcegraph into main

Created by: vdavid

Closes https://github.com/sourcegraph/sourcegraph/issues/34570 Closes https://github.com/sourcegraph/sourcegraph/issues/34569

This PR is not about the search feature, for a change. :)

Doing three things here:

  1. Bug fix: Fixed a bug that actually prevented the use of the feature altogether. I introduced this bug about three weeks ago when I refactored the utils, and as we don‘t often use this feature in the sandboxed IDE, we didn’t notice the bug.

  2. Default branch name: Changed the default branch name from “master” to “main” as “main” is becoming more common, and it’s more in line with our company culture.

  3. Priority change: Making sure that when the user right-clicks the code and copies the URL or opens it in a browser tab, we’re linking to the most relevant branch. The old order was: default (if set) > current (if exists on remote) > “master” The new order is: current (if exists on remote) > default (if set) > “main” Reasoning: As a team member, when I want to share a piece of code with a peer, I expect the link to point right to the code that I’m clicking on when creating the link. The most likely location of an up-to-date version of that code line is the branch I'm on. if the branch doesn’t exist on the remote, I’d like to fall back to the default branch, which is whatever branch we set up in Settings, or, in the lack of that, “main”. So I believe the altered version helps the user better. @slimsag, I think you were the one who implemented the previous solution. Do you remember if there was a specific customer expectation for the behavior? Or perhaps you think that linking main is a better solution because it's less ephemeral than feature branches?

Test plan

@philipp-spiess

@slimsag

  • Read point #3 and let me know your thoughts

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading