Skip to content

feat(tui): insert commits above or below existing commits#12925

Merged
davidpdrsn merged 1 commit intomasterfrom
dp/insert-commits-above-or-below
Mar 19, 2026
Merged

feat(tui): insert commits above or below existing commits#12925
davidpdrsn merged 1 commit intomasterfrom
dp/insert-commits-above-or-below

Conversation

@davidpdrsn
Copy link
Contributor

@davidpdrsn davidpdrsn commented Mar 19, 2026

Previously it was only possible to insert new commits at the top of a
branch, but with this change it's now also possible to insert new
commits above or below existing commits.


@vercel
Copy link

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Preview Mar 19, 2026 9:42am

Request Review

@github-actions github-actions bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Mar 19, 2026
@davidpdrsn davidpdrsn marked this pull request as ready for review March 19, 2026 09:30
Copilot AI review requested due to automatic review settings March 19, 2026 09:30
@davidpdrsn davidpdrsn force-pushed the dp/insert-commits-above-or-below branch 2 times, most recently from 4b810a5 to 6147c67 Compare March 19, 2026 09:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the legacy but TUI commit workflow to allow inserting a newly created commit above or below an existing commit, instead of only at the top of a branch. It also tightens commit-mode target scoping to the current stack and updates TUI snapshot tests accordingly.

Changes:

  • Add commit-mode support for selecting commit rows as insertion targets, with an insert-side toggle (above/below).
  • Render a synthetic “insert commit above/below” row around the selected commit to visualize insertion position.
  • Propagate stack IDs into commit rows to enforce commit-mode scoping, and add/refresh snapshot test coverage.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/but/src/command/legacy/status/tui/mod.rs Implements commit-to-commit insertion targeting, insert-side state, and synthetic row rendering in commit mode.
crates/but/src/command/legacy/status/tui/key_bind.rs Adds commit-mode keybinds to toggle insert side (a/b).
crates/but/src/command/legacy/status/tui/graph_extension.rs New helper to extend graph connector glyphs for the synthetic insertion row.
crates/but/src/command/legacy/status/tui/cursor/tests.rs Updates/extends cursor selectability tests for commit-mode stack scoping.
crates/but/src/command/legacy/status/output.rs Extends commit row metadata to carry stack_id for commit-mode scoping.
crates/but/src/command/legacy/status/mod.rs Plumbs stack IDs into commit rows when printing status output.
crates/but/src/command/legacy/status/tui/tests/commit_tests.rs Adds commit-mode tests + snapshot assertions for above/below insertion behavior and scoping.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_confirm_on_source_is_noop_final.txt New snapshot for commit confirm no-op behavior.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_from_unstaged_changes_creates_commit_visible_in_tui_final.txt New snapshot verifying commit creation from unstaged changes is visible.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_mode_can_toggle_commit_target_insert_side_final.txt New snapshot verifying toggling above/below indicator in commit mode.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_mode_enter_and_escape_final.txt New snapshot for entering/exiting commit mode.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_mode_from_staged_changes_stays_within_current_stack_final.txt New snapshot verifying commit-mode target scoping from staged-to-stack sources.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_mode_not_entered_from_non_commitable_rows_final.txt New snapshot verifying commit mode doesn’t start from non-committable rows.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_mode_shows_commit_above_on_commit_rows_final.txt New snapshot showing the synthetic “insert commit above” row.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_to_commit_above_creates_commit_visible_in_tui_final.txt New snapshot verifying insertion above a commit creates a visible commit.
crates/but/src/command/legacy/status/tui/tests/snapshots/commit_to_commit_below_creates_commit_visible_in_tui_final.txt New snapshot verifying insertion below a commit creates a visible commit.
crates/but/src/command/legacy/status/tui/tests/snapshots/staged_source_commit_cannot_be_forced_to_other_stack_target_final.txt New snapshot ensuring scoped commit sources can’t target other stacks.

You can also share your feedback on Copilot code review. Take the survey.

Previously it was only possible to insert new commits at the top of a
branch, but with this change it's now also possible to insert new
commits above or below existing commits.
@davidpdrsn davidpdrsn force-pushed the dp/insert-commits-above-or-below branch from 6147c67 to 2566ed1 Compare March 19, 2026 09:42
@davidpdrsn davidpdrsn enabled auto-merge March 19, 2026 09:42
@davidpdrsn davidpdrsn merged commit ef2b374 into master Mar 19, 2026
37 checks passed
@davidpdrsn davidpdrsn deleted the dp/insert-commits-above-or-below branch March 19, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants