diff --git a/lua/telescope/builtin/__git.lua b/lua/telescope/builtin/__git.lua index cc40503..28cdc16 100644 --- a/lua/telescope/builtin/__git.lua +++ b/lua/telescope/builtin/__git.lua @@ -313,7 +313,7 @@ git.status = function(opts) local gen_new_finder = function() local expand_dir = vim.F.if_nil(opts.expand_dir, true) - local git_cmd = { "git", "status", "-s", "--", "." } + local git_cmd = { "git", "status", "-z", "--", "." } if expand_dir then table.insert(git_cmd, #git_cmd - 1, "-u") @@ -331,7 +331,7 @@ git.status = function(opts) end return finders.new_table { - results = output, + results = vim.split(output[1], "", { trimempty = true }), entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_git_status(opts)), } end diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index d9e7ec7..58a7b78 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -1322,7 +1322,13 @@ function make_entry.gen_from_git_status(opts) if entry == "" then return nil end - local mod, file = string.match(entry, "(..).*%s[->%s]?(.+)") + + local mod, file = entry:match "^(..) (.+)$" + -- Ignore entries that are the PATH in XY ORIG_PATH PATH + -- (renamed or copied files) + if not mod then + return nil + end return setmetatable({ value = file,