sourcegraph/internal/codeintel/shared
Erik Seliger 0fdb44568f
gitserver: Serve Refs via gRPC method (#60323)
This PR migrates the ref specific calls to a gRPC endpoint.

While looking at this, I realized that we have many methods that want the same thing in the end: refs.

So instead of adding various endpoints (that currently use porcelain commands in the client implementation), we now use the plumbing command `for-each-ref` for all of them.

By that, we can combine the following APIs:

- `ListRefs` -> `ListRefs` (stays the same)
- `ListBranches` -> `ListBranches(headsOnly: true)`
- `ListTags` -> `ListBranches(tagsOnly: true)`
- For endpoints that were interested in both branches and tags, we allow the combination of the two `only` flags
- `BranchesContaining` -> `ListRefs(contains: sha)`
- `RefDescriptions` -> `ListRefs(headsOnly: true, tagsOnly: true)`

Through one simple call to `for-each-ref`, we also get to enjoy consistent ordering throughout. This also fixes an issue and improves perf for the branch picker where ordering would be random once the count hits 1000. 

Closes https://github.com/sourcegraph/sourcegraph/issues/55074

Closes https://github.com/sourcegraph/sourcegraph/issues/60415

## Test plan

Added tests at various layers, for gitcli, for the gRPC server, for the new client.
Also, existing tests still pass after this migration, including integration and E2E tests.
Manually ran my instance and clicked around as well, to verify.
2024-04-16 14:28:25 +02:00
..
background codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
lsifuploadstore codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
ranges codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
resolvers gitserver: Serve Refs via gRPC method (#60323) 2024-04-16 14:28:25 +02:00
trie codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
BUILD.bazel codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
db.go codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00
noop.go codeintel: consolidate enterprise & oss codeintel packages (#54431) 2023-07-05 14:58:41 +01:00