Skip to content

Commit

Permalink
fix(subprocess): handle stderr case for git ls-files
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Dec 10, 2021
1 parent caf51af commit aaf6804
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions lua/gitsigns/git.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions teal/gitsigns/git.tl
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,22 @@ Obj.update_file_info = function(self: Obj, update_relpath: boolean): boolean
end

Obj.file_info = function(self: Obj, file: string): M.FileProps
local results = self:command({
local results, stderr = self:command({
'ls-files',
'--stage',
'--others',
'--exclude-standard',
'--eol',
file or self.file
})
}, {supress_stderr = true})

if stderr then
-- Supress_stderr for the cases when we run:
-- git ls-files --others exists/nonexist
if not stderr:match('^warning: could not open directory .*: No such file or directory') then
gsd.eprint(stderr)
end
end

local result: M.FileProps = {}
for _, line in ipairs(results) do
Expand Down

0 comments on commit aaf6804

Please sign in to comment.