Skip to content

Finalize interrupted operations on gg continue #352

@mrmans0n

Description

@mrmans0n

Background

gg continue (crates/gg-core/src/commands/rebase.rs) runs git rebase --continue but does not finalize the op-log record of the operation that was interrupted by the conflict.

When a mutating operation (gg rebase, gg restack, including the mid-stack-insertion integration added in #351) hits a rebase conflict, its OperationGuard is dropped without finalize_*. Per the op-log design that's intentional at drop time — the record stays Pending and the sweep promotes it to Interrupted. But after the user resolves the conflict and runs gg continue, the mutation actually completes successfully, yet the original operation record is never committed. As a result that operation:

  • is not reported as undoable, and
  • cannot be undone via gg undo.

This is pre-existing behavior shared by all conflict-resumable paths; it is not specific to the mid-stack integration path, but that path (PR #351) surfaced it (see #351 (comment)).

Proposed approach

  • Persist the interrupted operation's id (and any context needed for the post-snapshot) so gg continue can find it — e.g. alongside the existing pending markers.
  • Add an operations API to finalize a Pending record by id from a separate invocation (snapshot post-mutation refs, mark Committed), and call it from gg continue after the rebase completes.
  • Cover both the normal gg restack/gg rebase conflict paths and the gg restack mid-stack integration path.
  • Tests: conflict → resolve → gg continuegg undo restores the pre-operation state.

Scope note

Deferred from #351 to keep that feature PR focused and to avoid expanding the undo subsystem as a tail-end change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions