Skip to content

Commit b4e4adb

Browse files
committed
Use cwd for selection.gitdiff
This fixes issue with switching directories after opening neovim. Closes #387 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent e2ce8d6 commit b4e4adb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lua/CopilotChat/select.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ function M.gitdiff(source, staged)
161161
return nil
162162
end
163163

164-
local cmd = 'git diff --no-color --no-ext-diff' .. (staged and ' --staged' or '')
164+
local dir = vim.fn.getcwd()
165+
local cmd = 'git -C ' .. dir .. ' diff --no-color --no-ext-diff' .. (staged and ' --staged' or '')
165166
local handle = io.popen(cmd)
166167
if not handle then
167168
return nil

0 commit comments

Comments
 (0)