Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lua/diffview/tests/functional/null_buffer_keymaps_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,18 @@ describe("shared null-buffer keymaps", function()
end, 10),
"Could not stage b.txt from the empty pane"
)
helpers.eq(
status .. "\tb.txt",
helpers.run({ "git", "diff", "--cached", "--name-status" }, repo)
-- The view's staged list is populated from one `git diff --cached`
-- subprocess inside `tracked_files`; the assertion below is a
-- separate subprocess reading the same index. Poll until the two
-- agree so we don't race the index write between the two reads.
local expected = status .. "\tb.txt"
local actual
assert.True(
vim.wait(5000, function()
actual = helpers.run({ "git", "diff", "--cached", "--name-status" }, repo)
return actual == expected
end, 50),
("git index did not reflect the stage of b.txt; last read: %q"):format(actual or "")
)
end)

Expand Down
Loading