fix: warn for inapplicable git commands
This commit is contained in:
+1
-1
@@ -465,7 +465,7 @@ end
|
|||||||
function M.run(args, opts)
|
function M.run(args, opts)
|
||||||
local r = repo.resolve()
|
local r = repo.resolve()
|
||||||
if not r then
|
if not r then
|
||||||
util.error("not in a git repository")
|
util.warning("not in a git repository")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ local M = {}
|
|||||||
function M.commit(opts)
|
function M.commit(opts)
|
||||||
local r = repo.resolve()
|
local r = repo.resolve()
|
||||||
if not r then
|
if not r then
|
||||||
util.error("not in a git repository")
|
util.warning("not in a git repository")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ function M.open(opts)
|
|||||||
other, err = infer_other(cur_buf)
|
other, err = infer_other(cur_buf)
|
||||||
end
|
end
|
||||||
if not other then
|
if not other then
|
||||||
util.error("%s", err or "no diff side")
|
util.warning("%s", err or "no diff side")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local mods = layout_mods(opts.mods, opts.layout)
|
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 cur_buf = vim.api.nvim_get_current_buf()
|
||||||
local new_buf, err = buf_for_side(new, cur_buf)
|
local new_buf, err = buf_for_side(new, cur_buf)
|
||||||
if not new_buf then
|
if not new_buf then
|
||||||
util.error("%s", err or "no new diff side")
|
util.warning("%s", err or "no new diff side")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local old_name, _, old_err = resolve_side(old, cur_buf)
|
local old_name, _, old_err = resolve_side(old, cur_buf)
|
||||||
if not old_name then
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ function M.open(opts)
|
|||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local r = repo.resolve()
|
local r = repo.resolve()
|
||||||
if not r then
|
if not r then
|
||||||
util.error("not in a git repository")
|
util.warning("not in a git repository")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ function M.open(opts)
|
|||||||
end
|
end
|
||||||
local r = repo.resolve()
|
local r = repo.resolve()
|
||||||
if not r then
|
if not r then
|
||||||
util.error("not in a git repository")
|
util.warning("not in a git repository")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user