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
+1 -1
View File
@@ -180,7 +180,7 @@ end
function M.run(args)
local r = repo.resolve()
if not r then
util.warning("not in a git repository")
util.error("not in a git repository")
return
end
+1 -1
View File
@@ -9,7 +9,7 @@ function M.commit(opts)
local amend = opts and opts.amend or false
local r = repo.resolve()
if not r then
util.warning("not in a git repository")
util.error("not in a git repository")
return
end
+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)
+1 -1
View File
@@ -126,7 +126,7 @@ function M.open(opts)
opts = opts or {}
local r = repo.resolve()
if not r then
util.warning("not in a git repository")
util.error("not in a git repository")
return
end
+4 -4
View File
@@ -268,7 +268,7 @@ end
local function load_blob(r, blob, path, sha)
local buf = blob_buf(r, blob, path, sha)
if not buf then
util.warning("no content for %s at %s", path, sha)
util.error("no content for %s at %s", path, sha)
return
end
vim.cmd.normal({ "m'", bang = true })
@@ -279,7 +279,7 @@ end
---@param section ow.Git.DiffSection
local function open_section(s, section)
if not section.blob_a or not section.blob_b then
util.warning("no index line, cannot determine blob SHAs")
util.error("no index line, cannot determine blob SHAs")
return
end
local parent = s.parent_sha or "0"
@@ -291,7 +291,7 @@ local function open_section(s, section)
return
end
if not left and not right then
util.warning("no content for %s", section.path_b)
util.error("no content for %s", section.path_b)
return
end
local buf = left or right
@@ -319,7 +319,7 @@ function M.open(r, rev, opts)
{ cwd = r.worktree, silent = true }
)
if not content then
util.warning("not a git object: %s", rev)
util.error("not a git object: %s", rev)
return
end
local buf = M.buf_for(r, parsed, content)
+4 -4
View File
@@ -56,7 +56,7 @@ function Repo:_fetch_status()
{ cwd = self.worktree, text = true },
vim.schedule_wrap(function(obj)
if obj.code ~= 0 then
util.warning(
util.error(
"git status failed: %s",
vim.trim(obj.stderr or "")
)
@@ -95,7 +95,7 @@ end
function Repo:start_watcher()
local watcher, err = vim.uv.new_fs_event()
if not watcher then
util.warning(
util.error(
"git: failed to create fs_event for %s: %s",
self.gitdir,
err
@@ -117,7 +117,7 @@ function Repo:start_watcher()
end
)
if not ok then
util.warning("failed to watch %s: %s", self.gitdir, tostring(start_err))
util.error("failed to watch %s: %s", self.gitdir, tostring(start_err))
watcher:close()
return
end
@@ -323,7 +323,7 @@ function M.resolve(arg)
f:close()
local rel = content:match("gitdir:%s*(%S+)")
if not rel then
util.warning(".git file at %s has no `gitdir:` line", found)
util.error(".git file at %s has no `gitdir:` line", found)
return nil
end
gitdir = vim.fs.normalize(