gdiff: define direct unmerged-file behavior #121
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
barrettruth/diffs.nvim#121
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent tracker: #270
Problem
Direct
:Gdiffon an unmerged worktree file can render a misleading generated diff.Observed in the local real-repo scenario matrix:
:Gdiffspliton a conflicted worktree file opens stage:1:against the worktree and warns:Use :Gdiffsplit! for 3 way diff.:Gdiffsplit!opens native 3-way diff windows for:2:, worktree, and:3:.diffs.nvim :Gdiffcurrently tries the normalindex -> worktreegenerated edge. Because an unmerged path has no normal stage-0 index entry, the left side can collapse to empty and the conflict-marker worktree file is rendered as a fake new-file diff.This is not an acceptable generated-workspace behavior. It makes the user think the whole conflicted file is newly added.
Product decision
Do not implement native
:Gdiffsplit!parity here. That belongs to the paired-window track (#252/#253).For generated
:Gdiff, direct invocation on an unmerged file should not render the fake new-file diff. Prefer routing to the existing generated unmerged view:git show :2:pathgit show :3:pathdiffs://unmerged:pathdu/dUpathIf the implementation finds a reason this is unsafe, it may instead show an explicit warning telling the user to use the Fugitive status-row unmerged action. It must not silently render an empty-index new-file diff.
Relevant existing code
lua/diffs/commands.luaM.gdiff()always parses direct command context as current worktree and rendersdiffspec.index_to_worktree(path)by default.M.gdiff_file(filepath, { unmerged = true })already renders:2:vs:3:and callsrequire("diffs.merge").setup_keymaps(...).replace_combined_diffs()also knows how to replace combined diff output with:2:vs:3:generated diffs.lua/diffs/fugitive.luadiff_file_under_cursor()passesunmerged = status == "U"when invoked from a Fugitive status row.lua/diffs/git.luaget_file_content(":2", filepath)andget_file_content(":3", filepath)support throughis_index_stage().Likely missing helper:
git ls-files --unmerged -- path.Acceptance criteria
:Gdiffnever shows an unmerged file as a fake new-file diff.:Gdiffsplit/:Gdiffsplit!behavior.