chore: apply formatting

This commit is contained in:
2026-05-26 17:30:18 +02:00
parent 914aa493ff
commit 428ded2c4c
12 changed files with 305 additions and 280 deletions
+17 -17
View File
@@ -80,28 +80,28 @@ t.test("M.open(HEAD:<path>) loads file content at HEAD", function()
object.open(r, "HEAD:a.txt", { split = false })
t.eq(vim.api.nvim_buf_get_name(0), "git://" .. sha .. ":a.txt")
t.eq(
vim.api.nvim_buf_get_lines(0, 0, -1, false),
{ "first", "second" }
)
t.eq(vim.api.nvim_buf_get_lines(0, 0, -1, false), { "first", "second" })
end)
t.test("M.open on a merge commit diffs against the first parent only", function()
local dir = h.make_repo({ ["a.txt"] = "one\n" })
t.write(dir, "a.txt", "two\n")
h.git(dir, "stash")
local stash = h.git(dir, "rev-parse", "stash@{0}").stdout
local r = assert(require("git.core.repo").resolve(dir))
t.test(
"M.open on a merge commit diffs against the first parent only",
function()
local dir = h.make_repo({ ["a.txt"] = "one\n" })
t.write(dir, "a.txt", "two\n")
h.git(dir, "stash")
local stash = h.git(dir, "rev-parse", "stash@{0}").stdout
local r = assert(require("git.core.repo").resolve(dir))
object.open(r, stash, { split = false })
local count = 0
for _, l in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, false)) do
if l:match("^diff %-%-git ") then
count = count + 1
object.open(r, stash, { split = false })
local count = 0
for _, l in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, false)) do
if l:match("^diff %-%-git ") then
count = count + 1
end
end
t.eq(count, 1, "the stashed file's diff appears once, not per-parent")
end
t.eq(count, 1, "the stashed file's diff appears once, not per-parent")
end)
)
t.test("M.open errors on a bogus base, no buffer is opened", function()
local dir = h.make_repo({ a = "first\n" })