aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fetch/git.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index 44151927..85714eb2 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -11,8 +11,8 @@ local util = require("luarocks.util")
11-- clone by tag then we'll have to issue a subsequent command to check out the 11-- clone by tag then we'll have to issue a subsequent command to check out the
12-- given tag. 12-- given tag.
13-- @return boolean: Whether Git can clone by tag. 13-- @return boolean: Whether Git can clone by tag.
14local function git_can_clone_by_tag() 14local function git_can_clone_by_tag(git_cmd)
15 local version_string = io.popen('git --version'):read() 15 local version_string = io.popen(git_cmd..' --version'):read()
16 local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)') 16 local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)')
17 major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0 17 major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0
18 local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10))) 18 local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10)))
@@ -57,7 +57,7 @@ function get_sources(rockspec, extract, dest_dir)
57 -- we can avoid passing it to Git since it's the default. 57 -- we can avoid passing it to Git since it's the default.
58 if tag_or_branch == "master" then tag_or_branch = nil end 58 if tag_or_branch == "master" then tag_or_branch = nil end
59 if tag_or_branch then 59 if tag_or_branch then
60 if git_can_clone_by_tag() then 60 if git_can_clone_by_tag(git_cmd) then
61 -- The argument to `--branch` can actually be a branch or a tag as of 61 -- The argument to `--branch` can actually be a branch or a tag as of
62 -- Git 1.7.10. 62 -- Git 1.7.10.
63 table.insert(command, 4, "--branch=" .. tag_or_branch) 63 table.insert(command, 4, "--branch=" .. tag_or_branch)