Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@samcoe
Copy link
Contributor

@samcoe samcoe commented Sep 27, 2022

Introduce the concept of a git client to be used for interacting with local git executable. I decided to keep the old interface for interacting with git in order to not break all the tests. I also kept in calls to run.PrepareCmd for this same reason. I was able to remove most of the calls to run.PrepareCmd as they are now consolidated in the new client. This PR maintains all current functionality and should result in no functional changes. None of the existing test assertions were changed.

In a future PR I will start inlining calls to the old interface with the equivalent client methods. I will also convert calls to git commands that need authentication to use the new client.AuthenticatedCommand method. These changes should be straight forward but would have ballooned this PR and resulted in test changes.

This PR also adds the a GitClient to the factory struct for convenience going forward.

@samcoe samcoe self-assigned this Sep 27, 2022
@samcoe samcoe changed the title WIP Create git client Sep 27, 2022
@samcoe samcoe force-pushed the git-client-2 branch 8 times, most recently from 299123c to 7c5ab08 Compare September 29, 2022 09:48
@samcoe samcoe marked this pull request as ready for review September 29, 2022 11:17
@samcoe samcoe requested a review from a team as a code owner September 29, 2022 11:17
@samcoe samcoe requested review from vilmibm and removed request for a team September 29, 2022 11:17
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Awesome start; thank you!

It's potentially a bit confusing that old-style git helpers like git.GitCommand() and git.CurrentBranch() are in the same package as the new git.Client, but I suspect you chose that to ease the gradual migration.

The main changes that I'd like to suggest for the new git Client is that it's concurrency-safe and that any I/O-bound operations take in a Context as the first argument.

@samcoe samcoe requested a review from mislav October 3, 2022 11:38
@samcoe
Copy link
Contributor Author

samcoe commented Oct 3, 2022

@mislav I addressed the changes you request if you wouldn't mind taking another look 🙇

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Looks awesome

@samcoe samcoe enabled auto-merge (squash) October 14, 2022 07:39
@samcoe samcoe merged commit 2944f7c into trunk Oct 14, 2022
@samcoe samcoe deleted the git-client-2 branch October 14, 2022 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants