fix: warn for inapplicable git commands
This commit is contained in:
+1
-1
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user