-
Couldn't load subscription status.
- Fork 7.3k
Create git client #6354
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
Create git client #6354
Conversation
299123c to
7c5ab08
Compare
fbf3aef to
306228b
Compare
a35d01e to
9e2ed48
Compare
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.
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.
|
@mislav I addressed the changes you request if you wouldn't mind taking another look 🙇 |
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.
Looks awesome
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.PrepareCmdfor this same reason. I was able to remove most of the calls torun.PrepareCmdas 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.AuthenticatedCommandmethod. These changes should be straight forward but would have ballooned this PR and resulted in test changes.This PR also adds the a
GitClientto the factory struct for convenience going forward.