-
Notifications
You must be signed in to change notification settings - Fork 47
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
Clear remote ref with auto merge #219
Conversation
@@ -162,3 +162,10 @@ func (g *Git) SparseCheckoutSet(opts ...string) *command.Model { | |||
args = append(args, opts...) | |||
return g.command(args...) | |||
} | |||
|
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.
How did this update if there is no go.sum change? Is the vendor folder consistent?
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.
Updated with correct vendor updates.
@@ -40,8 +40,15 @@ func (c checkoutPRMergeRef) do(gitCmd git.Git, fetchOpts fetchOptions, fallback | |||
// https://git-scm.com/book/en/v2/Git-Internals-The-Refspec | |||
refSpec := fmt.Sprintf("%s:%s", c.remoteMergeRef(), c.localMergeRef()) | |||
|
|||
// delete remote branch ref |
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.
Can you add a comment explaining why we need this? It's not trivial and no one will remember in a year
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.
Added comment.
// $ git update-ref -d refs/remotes/pull/7/merge | ||
err := deleteRef(gitCmd, c.remoteMergeRef()) | ||
if err != nil { | ||
return fmt.Errorf("failed to delte ref: %w", err) |
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.
The doc says that it first verifies that the ref exists before deleting it.. Which means we can't just run it all the time, it's going to bubble up the error if there is nothing to clean up.
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.
Tested on macos/linux, the git command does not fail.
Checklist
step.yml
andREADME.md
is updated with the changes (if needed)Version
Requires a PATCH version update
Context
When the git checkout directory is persisted between runs, we can encounter the following;
Changes
Investigation details
Decisions