Skip to content

Commit a3d9711

Browse files
feat(gerrit): Multi-branch indexing support for Gerrit (#433)
1 parent d74c943 commit a3d9711

File tree

13 files changed

+271
-1
lines changed

13 files changed

+271
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Added multi-branch indexing support for Gerrit. [#433](https://github.com/sourcebot-dev/sourcebot/pull/433)
12+
1013
## [4.6.3] - 2025-08-04
1114

1215
### Fixed

docs/docs/features/search/multi-branch-indexing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ Additional info:
8989
| Bitbucket Cloud ||
9090
| Bitbucket Data Center ||
9191
| Gitea ||
92-
| Gerrit | |
92+
| Gerrit | |
9393
| Generic git host ||
9494

docs/snippets/schemas/v3/connection.schema.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,47 @@
638638
}
639639
},
640640
"additionalProperties": false
641+
},
642+
"revisions": {
643+
"type": "object",
644+
"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.",
645+
"properties": {
646+
"branches": {
647+
"type": "array",
648+
"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.",
649+
"items": {
650+
"type": "string"
651+
},
652+
"examples": [
653+
[
654+
"main",
655+
"release/*"
656+
],
657+
[
658+
"**"
659+
]
660+
],
661+
"default": []
662+
},
663+
"tags": {
664+
"type": "array",
665+
"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.",
666+
"items": {
667+
"type": "string"
668+
},
669+
"examples": [
670+
[
671+
"latest",
672+
"v2.*.*"
673+
],
674+
[
675+
"**"
676+
]
677+
],
678+
"default": []
679+
}
680+
},
681+
"additionalProperties": false
641682
}
642683
},
643684
"required": [

docs/snippets/schemas/v3/gerrit.schema.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,47 @@
5959
}
6060
},
6161
"additionalProperties": false
62+
},
63+
"revisions": {
64+
"type": "object",
65+
"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.",
66+
"properties": {
67+
"branches": {
68+
"type": "array",
69+
"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.",
70+
"items": {
71+
"type": "string"
72+
},
73+
"examples": [
74+
[
75+
"main",
76+
"release/*"
77+
],
78+
[
79+
"**"
80+
]
81+
],
82+
"default": []
83+
},
84+
"tags": {
85+
"type": "array",
86+
"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.",
87+
"items": {
88+
"type": "string"
89+
},
90+
"examples": [
91+
[
92+
"latest",
93+
"v2.*.*"
94+
],
95+
[
96+
"**"
97+
]
98+
],
99+
"default": []
100+
}
101+
},
102+
"additionalProperties": false
62103
}
63104
},
64105
"required": [

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,47 @@
901901
}
902902
},
903903
"additionalProperties": false
904+
},
905+
"revisions": {
906+
"type": "object",
907+
"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.",
908+
"properties": {
909+
"branches": {
910+
"type": "array",
911+
"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.",
912+
"items": {
913+
"type": "string"
914+
},
915+
"examples": [
916+
[
917+
"main",
918+
"release/*"
919+
],
920+
[
921+
"**"
922+
]
923+
],
924+
"default": []
925+
},
926+
"tags": {
927+
"type": "array",
928+
"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.",
929+
"items": {
930+
"type": "string"
931+
},
932+
"examples": [
933+
[
934+
"latest",
935+
"v2.*.*"
936+
],
937+
[
938+
"**"
939+
]
940+
],
941+
"default": []
942+
}
943+
},
944+
"additionalProperties": false
904945
}
905946
},
906947
"required": [

packages/backend/src/repoCompileUtils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ export const compileGerritConfig = async (
310310
'zoekt.public': marshalBool(true),
311311
'zoekt.display-name': repoDisplayName,
312312
},
313+
branches: config.revisions?.branches ?? undefined,
314+
tags: config.revisions?.tags ?? undefined,
313315
} satisfies RepoMetadata,
314316
};
315317

packages/schemas/src/v3/connection.schema.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,47 @@ const schema = {
637637
}
638638
},
639639
"additionalProperties": false
640+
},
641+
"revisions": {
642+
"type": "object",
643+
"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.",
644+
"properties": {
645+
"branches": {
646+
"type": "array",
647+
"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.",
648+
"items": {
649+
"type": "string"
650+
},
651+
"examples": [
652+
[
653+
"main",
654+
"release/*"
655+
],
656+
[
657+
"**"
658+
]
659+
],
660+
"default": []
661+
},
662+
"tags": {
663+
"type": "array",
664+
"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.",
665+
"items": {
666+
"type": "string"
667+
},
668+
"examples": [
669+
[
670+
"latest",
671+
"v2.*.*"
672+
],
673+
[
674+
"**"
675+
]
676+
],
677+
"default": []
678+
}
679+
},
680+
"additionalProperties": false
640681
}
641682
},
642683
"required": [

packages/schemas/src/v3/connection.type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export interface GerritConnectionConfig {
244244
*/
245245
hidden?: boolean;
246246
};
247+
revisions?: GitRevisions;
247248
}
248249
export interface BitbucketConnectionConfig {
249250
/**

packages/schemas/src/v3/gerrit.schema.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,47 @@ const schema = {
5858
}
5959
},
6060
"additionalProperties": false
61+
},
62+
"revisions": {
63+
"type": "object",
64+
"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.",
65+
"properties": {
66+
"branches": {
67+
"type": "array",
68+
"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.",
69+
"items": {
70+
"type": "string"
71+
},
72+
"examples": [
73+
[
74+
"main",
75+
"release/*"
76+
],
77+
[
78+
"**"
79+
]
80+
],
81+
"default": []
82+
},
83+
"tags": {
84+
"type": "array",
85+
"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.",
86+
"items": {
87+
"type": "string"
88+
},
89+
"examples": [
90+
[
91+
"latest",
92+
"v2.*.*"
93+
],
94+
[
95+
"**"
96+
]
97+
],
98+
"default": []
99+
}
100+
},
101+
"additionalProperties": false
61102
}
62103
},
63104
"required": [

packages/schemas/src/v3/gerrit.type.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,18 @@ export interface GerritConnectionConfig {
2727
*/
2828
hidden?: boolean;
2929
};
30+
revisions?: GitRevisions;
31+
}
32+
/**
33+
* 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.
34+
*/
35+
export interface GitRevisions {
36+
/**
37+
* 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.
38+
*/
39+
branches?: string[];
40+
/**
41+
* 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.
42+
*/
43+
tags?: string[];
3044
}

0 commit comments

Comments
 (0)