fix: convert some warnings to errors

This commit is contained in:
2026-05-06 01:33:39 +02:00
parent c70d5dfce5
commit 2a81c50156
7 changed files with 23 additions and 23 deletions
+10 -10
View File
@@ -72,11 +72,11 @@ end
local function uri_split(opts, buf, rev)
local r = repo.resolve(buf)
if not r then
util.warning("git URI buffer has no worktree")
util.error("git URI buffer has no worktree")
return
end
if not rev.path then
util.warning("git URI has no path, cannot diff against worktree")
util.error("git URI has no path, cannot diff against worktree")
return
end
local object = require("git.object")
@@ -87,7 +87,7 @@ local function uri_split(opts, buf, rev)
{ cwd = r.worktree, silent = true }
)
if not content then
util.warning("invalid rev: %s", opts.rev)
util.error("invalid rev: %s", opts.rev)
return
end
place_pair(
@@ -102,7 +102,7 @@ local function uri_split(opts, buf, rev)
if not opts.rev then
local worktree_path = vim.fs.joinpath(r.worktree, rev.path)
if not vim.uv.fs_stat(worktree_path) then
util.warning("worktree file does not exist: %s", rev.path)
util.error("worktree file does not exist: %s", rev.path)
return
end
local worktree_buf = vim.fn.bufadd(worktree_path)
@@ -112,7 +112,7 @@ local function uri_split(opts, buf, rev)
end
if rev.stage == 1 then
util.warning("gD on merge base is ambiguous, use :Gdiffsplit <rev>")
util.error("gD on merge base is ambiguous, use :Gdiffsplit <rev>")
return
end
@@ -129,7 +129,7 @@ local function uri_split(opts, buf, rev)
{ cwd = r.worktree, silent = true }
)
if not content then
util.warning("invalid rev: %s", other_rev:format())
util.error("invalid rev: %s", other_rev:format())
return
end
place_pair(buf, object.buf_for(r, other_rev, content), left, opts.vertical)
@@ -150,17 +150,17 @@ function M.split(opts)
end
if cur_path == "" then
util.warning("no file in current buffer")
util.error("no file in current buffer")
return
end
if vim.bo[cur_buf].buftype ~= "" then
util.warning("cannot diff this buffer (not a worktree file)")
util.error("cannot diff this buffer (not a worktree file)")
return
end
cur_path = vim.fn.resolve(cur_path)
local r = repo.resolve(cur_path)
if not r then
util.warning("not in a git repository")
util.error("not in a git repository")
return
end
local rel = vim.fs.relpath(r.worktree, cur_path)
@@ -178,7 +178,7 @@ function M.split(opts)
{ cwd = r.worktree, silent = true }
)
if not content then
util.warning("invalid rev: %s", rev:format())
util.error("invalid rev: %s", rev:format())
return
end
local buf = require("git.object").buf_for(r, rev, content)