New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gitserver: Add CommitLog API to replace client-side Commits #62606
gitserver: Add CommitLog API to replace client-side Commits #62606
Conversation
58c7993
to
d6d0969
Compare
0c868de
to
223176c
Compare
d6d0969
to
245f9d6
Compare
223176c
to
75decf8
Compare
245f9d6
to
8d42c6f
Compare
75decf8
to
218c861
Compare
8d42c6f
to
683aa34
Compare
218c861
to
6a12a69
Compare
683aa34
to
dfd8c89
Compare
6a12a69
to
8d6dc0c
Compare
4af6a15
to
b3a07ae
Compare
// TODO: | ||
// Add tests for: | ||
// - AllRefs | ||
// - FollowOnlyFirstParent | ||
// - Order | ||
// - FollowPathRenames | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These didn't exist previously, I added tests for a few more settings here than we had before, but these are a bit more involved and don't impact the goal of finalizing the migration - so I decided to leave that for a rainy day.
message CommitLogResponse { | ||
repeated GetCommitResponse commits = 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on this? It's basically a batched GetCommit, and that response already carries the optional modified_files slice that we need for subrepo perms checks.
Alternatives I considered:
- Making a separate type, but otherwise same contents
- Add ModifiedFiles to
message GitCommit
directly, and use field masks to not compute it (sadly they're purely additive so I'd need to always send a mask for the default case of don't include them) - Use a
view
field like Google has in their gRPC APIs (I dislike that kinda, because there's no good tooling to know which view of a resource you got back -> easy to use a field on the client side that wasn't actually sent
413fc7e
to
535cfbc
Compare
This PR moves the Commits API to the server side and is the last gRPC API to migrate. Test plan: Existing tests are still passing, moved the ~extensive unit test coverage this had on the client side to the server side.
535cfbc
to
2e8df76
Compare
} | ||
|
||
// Safety check: ensure we are always starting with a record separator | ||
if data[0] != '\x1e' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we extract that into a constant?
if data[0] != '\x1e' { | |
const recordSeparator = '\x1e' | |
if data[0] != recordSeparator { |
This PR moves the Commits API to the server side and is the last gRPC API to migrate (considering LogReverseEach is already out for review).
Yet again (lack of integration tests), I had to reimplement some logic for the rockskip tests. We should investigate ways to run tests against actual gitservers, ideally without having to compile the whole server image and running that.
Closes #61690
Test plan:
Existing tests are still passing, moved the ~extensive unit test coverage this had on the client side to the server side, and reimplemented the subrepoperms tests for the new backend.