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
git: add PushConfig
to specify push config and add support for refspecs
#550
Conversation
Think this approach will become difficult when we add support for push options, as there are now multiple methods which would require the additional option as an argument. |
Main reason why I added a new function is that I didn't want to break the API. But your point regarding push options is certainly valid. How about we add a new type |
The second option would be to introduce an option pattern, which wouldn't break the existing API from a consumer perspective except for breaking the interface. |
The git package is not v1 so I would not worry about breaking changes, let's chose the best UX even if it means changing the functions args. |
If we don't have any problems breaking API, I don't see the harm in just passing the config object directly as an argument. It also follows the pattern for |
If we go that route, I would maybe even go as far as renaming |
cool sounds good to me as well |
1799dac
to
09a63be
Compare
PushConfig
to specify push config and add support for refspecs
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.
LGTM, thank you @aryan9600 🙇
Add `PushConfig` for configuring a push operation. Users can use `PushConfig.Refspecs` to specify the refspecs when using `Push()`. Furthermore, fix a bug related to `Push()` where all refs were pushed to origin, since we did not specify a refspec and the default refspec used by gogit is `refs/heads/*:/refs/heads/*`. Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Add `PushConfig.Force` for force pushing and remove `gogit.Client.forcePush` in favor of the former. Remove some stale test cases from `TestSwitchBranch` related to force push since we don't check if force pushing is enabled while switching branches anymore. Ref: #433 Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
talked to @pjbgf offline and he's okay with the removal of the obsolete tests |
Add
PushConfig
for configuring a push operation. Users can usePushConfig.Refspecs
to specify the refspecs when usingPush()
.Furthermore, fix a bug related to
Push()
where all refs were pushed to origin, since we did not specify a refspec and the default refspec used by gogit isrefs/heads/*:/refs/heads/*
.Add
PushConfig.Force
for force pushing and removegogit.Client.forcePush
in favor of the former.Remove some stale test cases from
TestSwitchBranch
related to force push since we don't check if force pushing is enabled while switching branches anymore. Ref: #433Part of: fluxcd/image-automation-controller#509