mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
Fix #972: Add tar-download support for Gitlab
This commit is contained in:
parent
866f39bb71
commit
1df50b3435
2 changed files with 9 additions and 3 deletions
|
|
@ -317,7 +317,7 @@ list.vue = {
|
||||||
|
|
||||||
list.jsonc = {
|
list.jsonc = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git",
|
url = "https://gitlab.com/WhyNotHugo/tree-sitter-jsonc",
|
||||||
files = { "src/parser.c" },
|
files = { "src/parser.c" },
|
||||||
},
|
},
|
||||||
readme_name = "JSON with comments",
|
readme_name = "JSON with comments",
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,15 @@ function M.select_mv_cmd(from, to, cwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.select_download_commands(repo, project_name, cache_folder, revision)
|
function M.select_download_commands(repo, project_name, cache_folder, revision)
|
||||||
if vim.fn.executable('tar') == 1 and vim.fn.executable('curl') == 1 and repo.url:find("github.com", 1, true) then
|
|
||||||
|
local is_github = repo.url:find("github.com", 1, true)
|
||||||
|
local is_gitlab = repo.url:find("gitlab.com", 1, true)
|
||||||
|
|
||||||
|
if vim.fn.executable('tar') == 1 and vim.fn.executable('curl') == 1 and (is_github or is_gitlab) then
|
||||||
|
|
||||||
revision = revision or repo.branch or "master"
|
revision = revision or repo.branch or "master"
|
||||||
local path_sep = utils.get_path_sep()
|
local path_sep = utils.get_path_sep()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
M.select_install_rm_cmd(cache_folder, project_name..'-tmp'),
|
M.select_install_rm_cmd(cache_folder, project_name..'-tmp'),
|
||||||
{
|
{
|
||||||
|
|
@ -122,7 +127,8 @@ function M.select_download_commands(repo, project_name, cache_folder, revision)
|
||||||
opts = {
|
opts = {
|
||||||
args = {
|
args = {
|
||||||
'-L', -- follow redirects
|
'-L', -- follow redirects
|
||||||
repo.url.."/archive/"..revision..".tar.gz",
|
is_github and repo.url.."/archive/"..revision..".tar.gz"
|
||||||
|
or repo.url.."/-/archive/"..revision.."/"..project_name.."-"..revision..".tar.gz",
|
||||||
'--output',
|
'--output',
|
||||||
project_name..".tar.gz"
|
project_name..".tar.gz"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue