Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: download mechanism works with GIT_DIR and GIT_WORK_TREE set #275

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lua/blink/cmp/fuzzy/download.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function download.get_lib_extension()
end

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

Expand Down Expand Up @@ -71,7 +72,7 @@ end

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