Skip to content

Commit 849900e

Browse files
committed
Do not run git diff against .git directory
This happens when running diff from `git commit` message. Closes CopilotC-Nvim#417 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent 2352cd3 commit 849900e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lua/CopilotChat/select.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ function M.gitdiff(source, staged)
167167
if not dir or dir == '' then
168168
return nil
169169
end
170+
dir = dir:gsub('.git$', '')
170171

171172
local cmd = 'git -C ' .. dir .. ' diff --no-color --no-ext-diff' .. (staged and ' --staged' or '')
172173
local handle = io.popen(cmd)

0 commit comments

Comments
 (0)