Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/backend/src/repoIndexManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ export class RepoIndexManager {
const allBranches = await getBranches(repoPath);
const matchingBranches =
allBranches
.filter((branch) => micromatch.isMatch(branch, branchGlobs))
.map((branch) => `refs/heads/${branch}`);
.filter((branch) => micromatch.isMatch(branch, branchGlobs));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a correct change. #800 is referring to the filter on the /repos page. We need to have refs/heads/ and refs/tags/ to allow the user to distinguish between filtering a branch and a tag (e.g., in the event where a tag and branch are named the same thing). This is documented here: https://docs.sourcebot.dev/docs/features/search/multi-branch-indexing#search-syntax

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current suggested change would still be a welcomed change.

  1. Making sure rev: maps to the short name of the default branch makes it easier for non technical people to understand which branch they are looking at. They might not know what refs/heads stands for, but they would know what main, feature/, etc are as that is generally what is displayed in all code hosting platforms
  2. If you specify, which branches to index in the SB configs, like this
    "revisions": {
        "branches":
          "main"
          "release/*"
        ]

it indexes main and ref/head separately (iirc)
3. I am working on adding the feature to be able to switch revisions directly from the code tree/preview panels. and this would be useful in my efforts. (and goes hand in hand with 1. above)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Making sure rev: maps to the short name of the default branch makes it easier for non technical people to understand which branch they are looking at.

I believe zoekt does a substring match. For example:
image
image

I would like to keep it such that a user can explicitly specify a refs/heads or refs/tags like this. In the UI, I think we can just strip the refs/heads & refs/tags

2.If you specify, which branches to index in the SB configs, like this it indexes main and ref/head separately (iirc)

This actually appears to be a bug. Tracked in #808

  1. I am working on adding the feature to be able to switch revisions directly from the code tree/preview panels. and this would be useful in my efforts. (and goes hand in hand with 1. above)

Cool! I assume you mean something like a dropdown selector that lets users switch between branches? Created #810 to track this if you want to discuss over there.


revisions = [
...revisions,
Expand Down