Skip to content

[FR] Index the default branch rather than HEAD #666

@gaeljw

Description

@gaeljw

Hello folks,

By default, Sourcebot indexes the default branch of a repository by actually using the HEAD. This works mostly fine (even though I suspect some errors when the default branch of a repo actually changes, like from master to main, but that's not my concern here :) ).

However, when browsing code and hitting the button "View in {platform}" (GitLab in my case), we then get redirected to a page showing HEAD rather than the default branch. Content is the same but from HEAD we cannot then edit the file to propose a change, we have first to switch to a branch (I'm not sure if this is specific to GitLab or not).

My suggestion (but I'm not sure of the impacts it could have) is that Sourcebot uses the platform metadata to retrieve the default branch name and use it as the Git reference rather than HEAD. Typically, retrieve from the platform that the default branch is main and then use main for indexing, browsing, redirecting...

I hope it makes sense.

I guess (haven't tried yet) that a workaround this is maybe to explicitly list the few usual names of the default branches in my connection config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions