From 703b1fec30c1e2ca7932b09996d34b9aaf8f43eb Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 16 Jul 2018 10:06:55 -0300 Subject: write_rockspec: detect git+ssh and hg+ssh --- src/luarocks/cmd/write_rockspec.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/luarocks/cmd/write_rockspec.lua b/src/luarocks/cmd/write_rockspec.lua index d3ec7b0d..cf9181e6 100644 --- a/src/luarocks/cmd/write_rockspec.lua +++ b/src/luarocks/cmd/write_rockspec.lua @@ -76,8 +76,14 @@ local lua_version_dep = { } local simple_scm_protocols = { - git = true, ["git+http"] = true, ["git+https"] = true, - hg = true, ["hg+http"] = true, ["hg+https"] = true + git = true, + ["git+http"] = true, + ["git+https"] = true, + ["git+ssh"] = true, + hg = true, + ["hg+http"] = true, + ["hg+https"] = true, + ["hg+ssh"] = true, } local detect_url @@ -89,10 +95,13 @@ do local url = pipe:read("*a"):match("^([^\r\n]+)") pipe:close() if not url then return nil end - if not util.starts_with(url, program.."://") then + if url:match("^[^@:/]+@[^@:/]+:.*$") then + local u, h, p = url:match("^([^@]+)@([^:]+):(.*)$") + url = program.."+ssh://"..u.."@"..h.."/"..p + elseif not util.starts_with(url, program.."://") then url = program.."+"..url end - + if simple_scm_protocols[dir.split_url(url)] then return url end -- cgit v1.2.3-55-g6feb