diff options
Diffstat (limited to 'lua/telescope/builtin/git.lua')
| -rw-r--r-- | lua/telescope/builtin/git.lua | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua index af5d4c6..2683107 100644 --- a/lua/telescope/builtin/git.lua +++ b/lua/telescope/builtin/git.lua @@ -15,13 +15,21 @@ local git = {} git.files = function(opts) if opts.is_bare then - error "This operation must be run in a work tree" + utils.notify("builtin.git_files", { + msg = "This operation must be run in a work tree", + level = "ERROR", + }) + return end local show_untracked = utils.get_default(opts.show_untracked, true) local recurse_submodules = utils.get_default(opts.recurse_submodules, false) if show_untracked and recurse_submodules then - error "Git does not support both --others and --recurse-submodules" + utils.notify("builtin.git_files", { + msg = "Git does not support both --others and --recurse-submodules", + level = "ERROR", + }) + return end -- By creating the entry maker after the cwd options, @@ -300,7 +308,11 @@ end git.status = function(opts) if opts.is_bare then - error "This operation must be run in a work tree" + utils.notify("builtin.git_status", { + msg = "This operation must be run in a work tree", + level = "ERROR", + }) + return end local gen_new_finder = function() @@ -308,13 +320,17 @@ git.status = function(opts) local git_cmd = { "git", "status", "-s", "--", "." } if expand_dir then - table.insert(git_cmd, table.getn(git_cmd) - 1, "-u") + table.insert(git_cmd, #git_cmd - 1, "-u") end local output = utils.get_os_command_output(git_cmd, opts.cwd) - if table.getn(output) == 0 then + if #output == 0 then print "No changes found" + utils.notify("builtin.git_status", { + msg = "No changes found", + level = "WARN", + }) return end |
