mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 09:50:04 -04:00
use gitlab api properly
This commit is contained in:
parent
0606c7a9dc
commit
099c0884b0
1 changed files with 3 additions and 2 deletions
|
|
@ -206,7 +206,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu
|
||||||
|
|
||||||
url = url:gsub('.git$', '')
|
url = url:gsub('.git$', '')
|
||||||
local target = is_gitlab
|
local target = is_gitlab
|
||||||
and string.format('%s/-/archive/%s/%s-%s.tar.gz', url, revision, project_name, revision)
|
and string.format('https://gitlab.com/api/v4/projects/%s/repository/archive.tar.gz?sha=%s', vim.uri_encode(url:match("gitlab%.com/([^/]+/[^/]+)"), "rfc2396"), revision)
|
||||||
or string.format('%s/archive/%s.tar.gz', url, revision)
|
or string.format('%s/archive/%s.tar.gz', url, revision)
|
||||||
|
|
||||||
local tarball_path = fs.joinpath(cache_dir, project_name .. '.tar.gz')
|
local tarball_path = fs.joinpath(cache_dir, project_name .. '.tar.gz')
|
||||||
|
|
@ -227,6 +227,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu
|
||||||
return logger:error('Error during download: %s', r.stderr)
|
return logger:error('Error during download: %s', r.stderr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
vim.cmd([[!ls /home/pedro/.cache/nvim/]])
|
||||||
|
|
||||||
do -- Create tmp dir
|
do -- Create tmp dir
|
||||||
logger:debug('Creating temporary directory: %s', tmp)
|
logger:debug('Creating temporary directory: %s', tmp)
|
||||||
|
|
@ -261,7 +262,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu
|
||||||
do -- Move tmp dir to output dir
|
do -- Move tmp dir to output dir
|
||||||
local dir_rev = revision:find('^v%d') and revision:sub(2) or revision
|
local dir_rev = revision:find('^v%d') and revision:sub(2) or revision
|
||||||
local repo_project_name = url:match('[^/]-$')
|
local repo_project_name = url:match('[^/]-$')
|
||||||
local extracted = fs.joinpath(tmp, repo_project_name .. '-' .. dir_rev)
|
local extracted = is_gitlab and fs.joinpath(tmp, repo_project_name .. '-' .. dir_rev .. '-' .. dir_rev) or fs.joinpath(tmp, repo_project_name .. '-' .. dir_rev)
|
||||||
logger:debug('Moving %s to %s/...', extracted, output_dir)
|
logger:debug('Moving %s to %s/...', extracted, output_dir)
|
||||||
local err = uv_rename(extracted, output_dir)
|
local err = uv_rename(extracted, output_dir)
|
||||||
a.schedule()
|
a.schedule()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue