Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [EE] Added mermaid diagram rendering to Ask Sourcebot answers, with pan/zoom, copy/export, in-thread deep links, and an interleaved right-panel view. [#1369](https://github.com/sourcebot-dev/sourcebot/pull/1369)
- [EE] Added a context-window usage gauge to the Ask Sourcebot chat details, showing how much of the selected model's context window each turn occupies. Window sizes are resolved from the models.dev catalog. [#1370](https://github.com/sourcebot-dev/sourcebot/pull/1370)
- Added language model input-modality and document capability resolution, automatically resolved from the models.dev catalog (falls back to text-only for uncatalogued/self-hosted models). [#1372](https://github.com/sourcebot-dev/sourcebot/pull/1372)
- Added `revisions.branchSort` and `revisions.tagSort` config options for controlling which matching refs are indexed first. [#1379](https://github.com/sourcebot-dev/sourcebot/pull/1379)

### Fixed
- Send anonymous server-side PostHog events as personless so unauthenticated requests don't inflate person counts. [#1367](https://github.com/sourcebot-dev/sourcebot/pull/1367)
Expand Down
14 changes: 10 additions & 4 deletions docs/docs/features/search/multi-branch-indexing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ By default, only the default branch of a repository is indexed and can be search
## Configuration

<Warning>
Multi-branch indexing is currently limited to 64 branches and tags. Please see [this issue](https://github.com/sourcebot-dev/sourcebot/issues/461) for more details.
Multi-branch indexing is currently limited to 64 total revisions per repository, including the default branch. Sourcebot indexes the default branch first, then matching branches, then matching tags. Please see [this issue](https://github.com/sourcebot-dev/sourcebot/issues/461) for more details.
</Warning>

Multi-branch indexing is configured in the [connection](/docs/connections/indexing-your-code) using the `revisions.branches` and `revisions.tags` arrays. Glob patterns are supported. For example:
Expand All @@ -39,6 +39,8 @@ Multi-branch indexing is configured in the [connection](/docs/connections/indexi
// Glob patterns
"feature/*" // Matches: feature/auth, feature/ui, etc.
],
// Optional. Defaults to "committerdate" (newest first).
"branchSort": "committerdate",

// These tags (if they exist):
"tags": [
Expand All @@ -48,14 +50,19 @@ Multi-branch indexing is configured in the [connection](/docs/connections/indexi
// Glob patterns
"v3.*.*", // Matches: v3.0.0, v3.0.1, etc.
"rc-*" // Matches: rc-1, rc-2, etc.
]
],
// Optional. Defaults to "creatordate" (newest first).
"tagSort": "creatordate"
}
}
}
}
```

For each repo defined in the connection, any branches or tags matching the patterns in `branches` and `tags` array will be indexed.
For each repo defined in the connection, any branches or tags matching the patterns in the `branches` and `tags` arrays will be considered for indexing.
When more matching refs exist than can be indexed, Sourcebot keeps the default branch first, then adds matching branches using `branchSort`, then adds matching tags using `tagSort`, and finally truncates the combined list to 64 total revisions. If matching branches fill the revision budget, matching tags may be skipped.

Supported sort values are `committerdate`, `creatordate`, and `refname`. These map to Git `for-each-ref` sort keys. Date-based sorts use newest-first ordering; `refname` sorts lexicographically by ref name. For branches, `creatordate` follows Git object creator-date semantics and is not a branch creation timestamp.

## Search syntax

Expand Down Expand Up @@ -91,4 +98,3 @@ Additional info:
| Gitea | ✅ |
| Gerrit | ✅ |
| Generic git host | ✅ |

26 changes: 23 additions & 3 deletions docs/snippets/schemas/v3/azuredevops.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@
},
"revisions": {
"type": "object",
"description": "The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed. A maximum of 64 revisions can be indexed, with any additional revisions being ignored.",
"description": "The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed first. Sourcebot can index at most 64 total revisions per repository, including the default branch. Matching branches are considered before matching tags, and any revisions beyond the 64 revision limit are ignored.",
"properties": {
"branches": {
"type": "array",
"description": "List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported. A maximum of 64 branches can be indexed, with any additional branches being ignored.",
"description": "List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported. Matching branches are considered before matching tags, and the combined default branch, branch, and tag revision list is capped at 64 total revisions.",
"items": {
"type": "string"
},
Expand All @@ -170,9 +170,19 @@
],
"default": []
},
"branchSort": {
"type": "string",
"description": "Sort order to use when listing candidate branches before matching branch glob patterns and applying the global 64 revision limit. Values map to Git `for-each-ref` sort keys. `committerdate` and `creatordate` sort newest-first, while `refname` sorts lexicographically by ref name. For branches, `creatordate` follows Git object creator-date semantics and is not a branch creation timestamp.",
"enum": [
"committerdate",
"creatordate",
"refname"
],
"default": "committerdate"
},
"tags": {
"type": "array",
"description": "List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported. A maximum of 64 tags can be indexed, with any additional tags being ignored.",
"description": "List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported. Matching tags are considered after matching branches, and the combined default branch, branch, and tag revision list is capped at 64 total revisions.",
"items": {
"type": "string"
},
Expand All @@ -186,6 +196,16 @@
]
],
"default": []
},
"tagSort": {
"type": "string",
"description": "Sort order to use when listing candidate tags before matching tag glob patterns and applying the global 64 revision limit. Values map to Git `for-each-ref` sort keys. `committerdate` and `creatordate` sort newest-first, while `refname` sorts lexicographically by ref name.",
"enum": [
"committerdate",
"creatordate",
"refname"
],
"default": "creatordate"
}
},
"additionalProperties": false
Expand Down
26 changes: 23 additions & 3 deletions docs/snippets/schemas/v3/bitbucket.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@
},
"revisions": {
"type": "object",
"description": "The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed. A maximum of 64 revisions can be indexed, with any additional revisions being ignored.",
"description": "The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed first. Sourcebot can index at most 64 total revisions per repository, including the default branch. Matching branches are considered before matching tags, and any revisions beyond the 64 revision limit are ignored.",
"properties": {
"branches": {
"type": "array",
"description": "List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported. A maximum of 64 branches can be indexed, with any additional branches being ignored.",
"description": "List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported. Matching branches are considered before matching tags, and the combined default branch, branch, and tag revision list is capped at 64 total revisions.",
"items": {
"type": "string"
},
Expand All @@ -143,9 +143,19 @@
],
"default": []
},
"branchSort": {
"type": "string",
"description": "Sort order to use when listing candidate branches before matching branch glob patterns and applying the global 64 revision limit. Values map to Git `for-each-ref` sort keys. `committerdate` and `creatordate` sort newest-first, while `refname` sorts lexicographically by ref name. For branches, `creatordate` follows Git object creator-date semantics and is not a branch creation timestamp.",
"enum": [
"committerdate",
"creatordate",
"refname"
],
"default": "committerdate"
},
"tags": {
"type": "array",
"description": "List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported. A maximum of 64 tags can be indexed, with any additional tags being ignored.",
"description": "List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported. Matching tags are considered after matching branches, and the combined default branch, branch, and tag revision list is capped at 64 total revisions.",
"items": {
"type": "string"
},
Expand All @@ -159,6 +169,16 @@
]
],
"default": []
},
"tagSort": {
"type": "string",
"description": "Sort order to use when listing candidate tags before matching tag glob patterns and applying the global 64 revision limit. Values map to Git `for-each-ref` sort keys. `committerdate` and `creatordate` sort newest-first, while `refname` sorts lexicographically by ref name.",
"enum": [
"committerdate",
"creatordate",
"refname"
],
"default": "creatordate"
}
},
"additionalProperties": false
Expand Down
Loading