Skip to content

Commit

Permalink
Use cwd for selection.gitdiff
Browse files Browse the repository at this point in the history
This fixes issue with switching directories after opening neovim.

Closes #387

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
  • Loading branch information
deathbeam committed Aug 31, 2024
1 parent e2ce8d6 commit b4e4adb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/CopilotChat/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ function M.gitdiff(source, staged)
return nil
end

local cmd = 'git diff --no-color --no-ext-diff' .. (staged and ' --staged' or '')
local dir = vim.fn.getcwd()
local cmd = 'git -C ' .. dir .. ' diff --no-color --no-ext-diff' .. (staged and ' --staged' or '')
local handle = io.popen(cmd)
if not handle then
return nil
Expand Down

0 comments on commit b4e4adb

Please sign in to comment.