Skip to content

feat(tui): pick the commit's contents, then its place in the tree - #282

Merged
narnaud merged 1 commit into
mainfrom
tui-commit
Sep 19, 2026
Merged

narnaud merged 1 commit into
mainfrom
tui-commit

Conversation

@narnaud

@narnaud narnaud commented Sep 19, 2026

Copy link
Copy Markdown
Owner

c mixed two ways of saying what to commit: the selected rows, and whatever
the index already held. Nothing in the TUI stages, so an index entry could only
come from outside it, and the [local changes] header — which d and f read
as zz — fell through to a bare loom commit that took the index alone.

The rows are the only signal now. Working files and that header are always
passed as file arguments, so a file staged elsewhere is committed whole or not
at all, and every other row is a notice. Hunks picked with git add -p are
overridden this way, which is the -p gap the TUI already has.

The branch picker is gone too. The tree is rebuilt with the commit faked in at
its destination — the integration line first, then every woven branch — and
↑/↓ move it there, the way b draws a branch before it exists. The preview
goes through the same section builder, so a stack stays stacked and a branch
that owns nothing forks from the base. Enter runs loom commit -i or
loom commit -b <branch>, Esc puts the tree back.

Creating a branch from the commit prompt is what this drops: press b first,
then c.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Change-Id: I05ebbfcde0cecb2417f3275783ac340f2465c0ac

Summary by CodeRabbit

  • New Features

    • Added interactive commit placement in the TUI.
    • Commit selected working files or all local changes.
    • Choose integration or branch destinations before confirming.
    • Preview pending commits, including tracked and untracked changes.
    • Press Esc to cancel commit placement.
  • Bug Fixes

    • Prevented empty selections from displaying the entire working-tree diff.
    • Improved navigation, previews, and cursor behavior during commit placement.

@narnaud
narnaud added this pull request to stack #283 September 19, 2026 17:21
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: c3c7e042-36ec-44c7-9905-e9181eba4c0f

📥 Commits

Reviewing files that changed from the base of the PR and between d442d8f and 639817e.

📒 Files selected for processing (8)
  • docs/src/commands/tui.md
  • specs/020-tui.md
  • src/git/git_diff.rs
  • src/git/git_diff_test.rs
  • src/git/mod.rs
  • src/tui/app.rs
  • src/tui/app_test.rs
  • src/tui/status_tree.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The TUI now supports interactive commit placement. It validates working-tree selections, previews pending commits, supports integration or branch destinations, and confirms or cancels placement. Diff helpers and tests cover selected tracked and untracked changes.

Changes

TUI commit placement

Layer / File(s) Summary
Pending commit model and tree placement
src/tui/app.rs, src/tui/status_tree.rs, src/tui/app_test.rs
The TUI represents pending commits with destination metadata, placeholder rows, preview messages, and branch-stack placement. Pending rows use a sentinel OID and do not expose commit targets.
Pending commit diff support
src/git/git_diff.rs, src/git/git_diff_test.rs, src/git/mod.rs, src/tui/app.rs, src/tui/app_test.rs, docs/src/commands/tui.md, specs/020-tui.md
HEAD-relative diffs now accept multiple paths and return no output for an empty path list. Pending commit previews combine selected tracked diffs with bounded untracked-file contents.
Commit target interaction and execution
src/tui/app.rs, src/tui/app_test.rs, docs/src/commands/tui.md, specs/020-tui.md
Commit placement validates selected rows, supports destination navigation, blocks unrelated input, confirms with Enter, cancels with Esc, and generates integration or branch commit commands. Tests cover selection, destinations, rendering, cancellation, failures, and command arguments.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant TUI
  participant CommitTarget
  participant DiffPreview
  participant LoomCommit
  TUI->>CommitTarget: validate selected working-tree files
  CommitTarget->>DiffPreview: preview selected changes
  TUI->>CommitTarget: choose integration or branch destination
  TUI->>LoomCommit: confirm and pass -i or -b
Loading

Suggested reviewers: dfaure-kdab

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: selecting commit contents and choosing the commit's placement in the tree through the TUI.
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 6 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

Base automatically changed from change-id to main September 19, 2026 18:39
`c` mixed two ways of saying what to commit: the selected rows, and whatever
the index already held. Nothing in the TUI stages, so an index entry could only
come from outside it, and the `[local changes]` header — which `d` and `f` read
as `zz` — fell through to a bare `loom commit` that took the index alone.

The rows are the only signal now. Working files and that header are always
passed as file arguments, so a file staged elsewhere is committed whole or not
at all, and every other row is a notice. Hunks picked with `git add -p` are
overridden this way, which is the `-p` gap the TUI already has.

The branch picker is gone too. The tree is rebuilt with the commit faked in at
its destination — the integration line first, then every woven branch — and
↑/↓ move it there, the way `b` draws a branch before it exists. The preview
goes through the same section builder, so a stack stays stacked and a branch
that owns nothing forks from the base. Enter runs `loom commit -i` or
`loom commit -b <branch>`, Esc puts the tree back.

Creating a branch from the commit prompt is what this drops: press `b` first,
then `c`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: I05ebbfcde0cecb2417f3275783ac340f2465c0ac
@narnaud
narnaud merged commit 2fcb64b into main Sep 19, 2026
6 checks passed
@narnaud
narnaud deleted the tui-commit branch September 19, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant