Skip to content

Commit 8c9930c

Browse files
authored
fix: download mechanism works with GIT_DIR and GIT_WORK_TREE set (#275)
Explicitly provide `--git-dir` and `--work-tree` in git commands
1 parent 1628800 commit 8c9930c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/blink/cmp/fuzzy/download.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function download.get_lib_extension()
1010
end
1111

1212
local root_dir = debug.getinfo(1).source:match('@?(.*/)')
13+
local repo_dir = vim.fs.root(root_dir, '.git')
1314
download.lib_path = root_dir .. '../../../../target/release/libblink_cmp_fuzzy' .. download.get_lib_extension()
1415
local version_path = root_dir .. '../../../../target/release/version.txt'
1516

@@ -71,7 +72,7 @@ end
7172

7273
--- @param cb fun(err: string | nil, tag: string | nil)
7374
function download.get_git_tag(cb)
74-
vim.system({ 'git', 'describe', '--tags', '--exact-match' }, { cwd = root_dir }, function(out)
75+
vim.system({ 'git', '--git-dir', vim.fs.joinpath(repo_dir, '.git'), "--work-tree", repo_dir, 'describe', '--tags', '--exact-match' }, { cwd = root_dir }, function(out)
7576
if out.code == 128 then return cb() end
7677
if out.code ~= 0 then
7778
return cb('While getting git tag, git exited with code ' .. out.code .. ': ' .. out.stderr)

0 commit comments

Comments
 (0)