Repository navigation
Add fixup/squash commit actions with instant variants - #3
Merged
Merged
Conversation
The commit menu gains f/s (create a fixup!/squash! commit for a picked target) and F/S, the equivalents of magit-commit-instant-fixup/-squash: after creating the marker commit, an autosquash rebase immediately folds it into its target. The rebase todo is accepted as generated via sequence.editor=true; instant fixup runs fully in the background, while instant squash takes the foreground editor handoff since git opens $EDITOR to combine the two messages. Targets without a parent rebase with --root, and a dirty worktree is carried across via --autostash. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Cx7mBkk3WHNtg124U85qV
A stringly-typed kind parameter allowed nonsense values and the helpers were named after only one of the two variants. The marker flavor is now a two-variant Marker enum, and the helpers are named for what they do: marker_commit creates the fixup!/squash! commit, instant_rebase folds it into its target. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Cx7mBkk3WHNtg124U85qV
Marker named the enum after the commit it creates, but what the two variants actually distinguish is the flavor of autosquash rebase the marker commit asks for. Rename to AutosquashKind and spell out in autosquash_marker_commit which marker the helper creates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Cx7mBkk3WHNtg124U85qV
Fixup and squash are not kinds of autosquash — autosquash is the mechanism that processes both markers in one rebase. What the two variants are is the meld todo actions (git's own todo help: "meld into previous commit"), the vocabulary rebase.rs already uses for TodoAction::Fixup/Squash. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Cx7mBkk3WHNtg124U85qV
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.
Implement fixup and squash commit operations, including instant variants that immediately fold the marker commit into its target via autosquash rebase.
Summary
This adds four new transient menu actions to the commit menu (
f,F,s,S):f): Creates afixup!marker commit for a picked targetF): Creates the marker commit and immediately rebases it in withsequence.editor=true(magit-commit-instant-fixup)s): Creates asquash!marker commit for a picked targetS): Creates the marker commit and immediately rebases it in, stopping for the editor to combine messages (magit-commit-instant-squash)Key Changes
MeldKindenum (src/app/ops/commit.rs): Abstracts over fixup vs. squash behavior with a sharedas_str()method for option namesautosquash_marker_commit()method: Opens a picker over commits, validates that there are staged changes (or--allflag), then creates the marker commit withgit commit --fixup=<rev>or--squash=<rev>instant_rebase()method: For instant variants, runs the marker commit synchronously (or in background for fixup), then performs an interactive autosquash rebase withsequence.editor=trueto skip editor stops. For squash, the rebase takes the foreground editor handoff to combine messagessrc/ui/transient.rs): Added four newTransientActionvariants and menu items to theCOMMITtransient definitionsrc/app/ops/mod.rs): Wired the new actions intoinvoke_transient()tests/git_integration.rs): Addedinstant_fixup_folds_staged_changes_into_target()integration test verifying the full command sequencesrc/app/workers.rs): Madepush_process_entry()public for the instant rebase flow to log the marker commitImplementation Details
The instant variants never stop for an editor:
run_git_seq_bg()EditorRequestwithGIT_SEQUENCE_EDITOR=trueRoot commits are handled by detecting whether the target has a parent; if not, rebase uses
--rootas the onto point.https://claude.ai/code/session_012Cx7mBkk3WHNtg124U85qV