Skip to content

fix(vcs): use merge-base semantics for range-to-working-tree diffs - #181

Open
athal7 wants to merge 1 commit into
jnsahaj:mainfrom
athal7:fix/three-dot-diff
Open

fix(vcs): use merge-base semantics for range-to-working-tree diffs#181
athal7 wants to merge 1 commit into
jnsahaj:mainfrom
athal7:fix/three-dot-diff

Conversation

@athal7

@athal7 athal7 commented Jul 13, 2026

Copy link
Copy Markdown

<from>..- diffs from directly against HEAD (two-dot) before unioning
with working-tree changes, instead of using merge-base (three-dot)
semantics like <from>...<to> does. This means commits made on from
after it diverged from HEAD incorrectly show up in the diff.

Fixes both the lumen explain path (src/main.rs) and the lumen diff
TUI path (DiffRefs::from_options), mirroring the merge-base handling
already used by the TripleDots arm in each. Adds regression tests
covering diverging branches in both src/vcs/git.rs and
src/command/diff/git.rs.

`<from>..-` was diffing `from` directly against HEAD (two-dot) before
unioning with working-tree changes, instead of using merge-base
(three-dot) semantics like `<from>...<to>` does. This meant commits
made on `from` after it diverged from HEAD incorrectly showed up as
part of the diff.

Fixes both the `lumen explain` path (src/main.rs, get_range_diff now
passes three_dot=true) and the `lumen diff` TUI path
(DiffRefs::from_options, which now computes merge-base before storing
`from`, mirroring the existing TripleDots arm).

Co-Authored-By: anthropic/claude-sonnet-5 <noreply@opencode.ai>
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