fix: warn for inapplicable git commands

This commit is contained in:
2026-05-29 14:29:09 +02:00
parent 193616e87d
commit e6616e260b
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -465,7 +465,7 @@ end
function M.run(args, opts)
local r = repo.resolve()
if not r then
util.error("not in a git repository")
util.warning("not in a git repository")
return
end
+1 -1
View File
@@ -8,7 +8,7 @@ local M = {}
function M.commit(opts)
local r = repo.resolve()
if not r then
util.error("not in a git repository")
util.warning("not in a git repository")
return
end
+3 -3
View File
@@ -172,7 +172,7 @@ function M.open(opts)
other, err = infer_other(cur_buf)
end
if not other then
util.error("%s", err or "no diff side")
util.warning("%s", err or "no diff side")
return
end
local mods = layout_mods(opts.mods, opts.layout)
@@ -197,12 +197,12 @@ function M.open_pair(old, new, opts)
local cur_buf = vim.api.nvim_get_current_buf()
local new_buf, err = buf_for_side(new, cur_buf)
if not new_buf then
util.error("%s", err or "no new diff side")
util.warning("%s", err or "no new diff side")
return
end
local old_name, _, old_err = resolve_side(old, cur_buf)
if not old_name then
util.error("%s", old_err or "no old diff side")
util.warning("%s", old_err or "no old diff side")
return
end
+1 -1
View File
@@ -81,7 +81,7 @@ function M.open(opts)
opts = opts or {}
local r = repo.resolve()
if not r then
util.error("not in a git repository")
util.warning("not in a git repository")
return
end
+1 -1
View File
@@ -685,7 +685,7 @@ function M.open(opts)
end
local r = repo.resolve()
if not r then
util.error("not in a git repository")
util.warning("not in a git repository")
return
end