Repository navigation
Conversation
The rebase onto upstream's request-based restack API introduced restack.BranchRequest usage in merge/handler_test.go without the corresponding import, so the package failed to compile. All internal/handler test packages pass and go build ./... is clean.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--skip-conflictsflag to all restack commands (gs repo restack,gs stack restack,gs upstack restack,gs downstack restack,gs branch restack). When set, any branch that cannot be rebased cleanly due to a conflict is aborted and skipped (along with its upstack descendants) and logged, instead of dropping into the interactive conflict-resolution flow. The rest of the branches still restack, and the command exits successfully with a summary of how many branches were skipped.Why this matters (#116)
Today a single conflicting branch blocks an entire multi-branch restack such as
gs repo restack. For stale stacks the user does not intend to work on, this forces them into a rescue/continue cycle just to get the rest of their branches restacked. As raised in #116, it is useful to opt into skipping conflicting branches and logging the un-rebased stacks (prior art: Graphite). The flag is off by default, so existing behavior is unchanged.Changes
restack.Requestgains aSkipConflictsfield. In the restack loop, aRebaseInterruptConflictis aborted and skipped (warning<branch>: conflict, skipping) when the flag is set; descendants of a skipped branch are skipped consistently, and a finalSkipped N branch(es) due to conflictssummary is logged.RestackBranch/RestackStack/RestackUpstack/RestackDownstackhandler entrypoints (via small per-command options structs) and the corresponding CLI commands.Testing
internal/handler/restackcovering: a conflicting branch plus its upstack being skipped while an independent branch restacks; the all-conflicts case still returning to the starting branch; and a deliberate interrupt still routing to rescue.testdata/script/restack_skip_conflicts.txtexercisinggs repo restack --skip-conflictsend to end (conflicting stack skipped, clean branch restacked, working tree clean, back on the starting branch, exit 0).go build ./...,go vet, the affected package tests, the command help fixtures, and the new test script all pass.Fixes #116
AI was used for assistance.