Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

gitserver: grpc: port DiffSymbols from client as new GitBackend.ChangedFiles() func#62252

Merged
ggilmore merged 1 commit into
mainfrom
04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func
May 7, 2024
Merged

gitserver: grpc: port DiffSymbols from client as new GitBackend.ChangedFiles() func#62252
ggilmore merged 1 commit into
mainfrom
04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func

Conversation

@ggilmore

@ggilmore ggilmore commented Apr 29, 2024

Copy link
Copy Markdown
Contributor

Part of https://github.com/sourcegraph/sourcegraph/issues/61691

This PR adds a new method, ChangedFiles to the git cli backend that lists the files that between the base and head commits, along with their added/modified/deleted status. Unlike the current workflow that involves multiple callsites with their own implementations for parsing the raw gitserver exec output, all the parsing now happens server-side and is well tested.

This functionality should be able to subsume the other diff-tree / diff use-cases in:

Test plan

Added new unit tests:

ggilmore commented Apr 29, 2024

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ggilmore and the rest of your teammates on Graphite Graphite

@github-actions github-actions Bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Apr 29, 2024
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from d02b395 to 39e5cfb Compare April 30, 2024 05:16
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from cc96f91 to 75dd653 Compare April 30, 2024 05:16
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 39e5cfb to 3e6f221 Compare April 30, 2024 05:20
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 75dd653 to 18d4bba Compare April 30, 2024 05:20
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 3e6f221 to ca768ec Compare April 30, 2024 17:03
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 18d4bba to 7a9e364 Compare April 30, 2024 17:03
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from ca768ec to dd16782 Compare April 30, 2024 17:14
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 7a9e364 to 319d6a9 Compare April 30, 2024 17:15
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from dd16782 to 6d618e6 Compare April 30, 2024 18:06
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 319d6a9 to d8cb7fe Compare April 30, 2024 18:06
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 6d618e6 to a450397 Compare April 30, 2024 19:21
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from d8cb7fe to 59cae3e Compare April 30, 2024 19:21
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from a450397 to 48fb88c Compare April 30, 2024 19:22
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 59cae3e to 43d8723 Compare April 30, 2024 19:22
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 48fb88c to 1a44563 Compare April 30, 2024 19:37
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 43d8723 to 9e1c79e Compare April 30, 2024 19:37
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 1a44563 to 8ad5a04 Compare April 30, 2024 20:07
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 666d72e to 1740b89 Compare May 1, 2024 21:12
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 1137bf8 to 305509c Compare May 1, 2024 21:12
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 1740b89 to 15bf6fb Compare May 1, 2024 21:17
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 305509c to 2e3e0ff Compare May 1, 2024 21:17
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 15bf6fb to 9ffa2d5 Compare May 1, 2024 21:21
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 2e3e0ff to 71f085f Compare May 1, 2024 21:21
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 9ffa2d5 to 34cd911 Compare May 1, 2024 21:25
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch 2 times, most recently from 57d4a5c to 82e2db3 Compare May 1, 2024 21:30
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated
@ggilmore ggilmore requested a review from a team May 1, 2024 22:11
@ggilmore ggilmore marked this pull request as ready for review May 1, 2024 22:11
Comment thread cmd/gitserver/internal/git/gitcli/diff_test.go Outdated
Comment thread cmd/gitserver/internal/git/gitcli/diff_test.go Outdated
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated
@graphite-app

graphite-app Bot commented May 2, 2024

Copy link
Copy Markdown

TV gif. We look up at Rowan Atkinson as Mr. Bean wearing medical scrubs. He pulls down a surgical mask, gives a gloved thumbs up, and smiles maniacally. (Added via Giphy)

@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from 34cd911 to b56c84d Compare May 2, 2024 17:43
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 82e2db3 to 5650c82 Compare May 2, 2024 17:43
@ggilmore ggilmore force-pushed the 04-26-gitserver_grpc_swap_client_implementation_of_getaheadbehind_from_exec_to_bespoke_grpc_endpoint branch from b56c84d to 0ed26eb Compare May 2, 2024 17:45
@ggilmore ggilmore force-pushed the 04-29-gitserver_grpc_port_diffsymbols_from_client_as_new_gitbackend.changedfiles_func branch from 5650c82 to f800d7e Compare May 2, 2024 17:45
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated

ggilmore commented May 6, 2024

Copy link
Copy Markdown
Contributor Author

@sourcegraph/source Could you please re-review this (and the upstream PRs)? I refactored the approach to use the iterator pattern.

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a question about using an iterator here as well

Comment on lines 110 to 116

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in LogReverseEach that we had here: https://github.com/sourcegraph/sourcegraph/pull/62260/files#diff-e7b89c0e3e24a2fda065a7cfa5f06f7b7def4d36189d88e495e5b40f5ca9795fL112-L194 also does some more checks on submodule status and stuff. Not sure if needed here, but might be cool for consolidation. We can do that separately though

Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated
Comment thread cmd/gitserver/internal/git/gitcli/diff.go Outdated

ggilmore commented May 7, 2024

Copy link
Copy Markdown
Contributor Author

Merge activity

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants