From 1df50b3435e4753c56a58c80fd9486c2213138a8 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Mon, 1 Mar 2021 17:18:51 +0100 Subject: Fix #972: Add tar-download support for Gitlab --- lua/nvim-treesitter/shell_command_selectors.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lua/nvim-treesitter/shell_command_selectors.lua') diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua index 53263228..bd5e9097 100644 --- a/lua/nvim-treesitter/shell_command_selectors.lua +++ b/lua/nvim-treesitter/shell_command_selectors.lua @@ -109,10 +109,15 @@ function M.select_mv_cmd(from, to, cwd) end 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" local path_sep = utils.get_path_sep() + return { 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 = { args = { '-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', project_name..".tar.gz" }, -- cgit v1.2.3