aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fetch/git.lua8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index f8c0f2c8..e5f1ad4d 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -23,10 +23,9 @@ function get_sources(rockspec, extract, dest_dir)
23 -- Strip off .git from base name if present 23 -- Strip off .git from base name if present
24 module = module:gsub("%.git$", "") 24 module = module:gsub("%.git$", "")
25 local command = {git_cmd, "clone", "--depth=1", rockspec.source.url, module} 25 local command = {git_cmd, "clone", "--depth=1", rockspec.source.url, module}
26 local checkout_command
27 local tag_or_branch = rockspec.source.tag or rockspec.source.branch 26 local tag_or_branch = rockspec.source.tag or rockspec.source.branch
28 if tag_or_branch then 27 if tag_or_branch then
29 checkout_command = {git_cmd, "checkout", "-q", tag_or_branch} 28 table.insert(command, 4, "--branch=" .. tag_or_branch)
30 end 29 end
31 local store_dir 30 local store_dir
32 if not dest_dir then 31 if not dest_dir then
@@ -44,11 +43,6 @@ function get_sources(rockspec, extract, dest_dir)
44 return nil, "Failed cloning git repository." 43 return nil, "Failed cloning git repository."
45 end 44 end
46 fs.change_dir(module) 45 fs.change_dir(module)
47 if checkout_command then
48 if not fs.execute(unpack(checkout_command)) then
49 return nil, "Failed checking out tag/branch from git repository."
50 end
51 end
52 fs.delete(dir.path(store_dir, module, ".git")) 46 fs.delete(dir.path(store_dir, module, ".git"))
53 fs.delete(dir.path(store_dir, module, ".gitignore")) 47 fs.delete(dir.path(store_dir, module, ".gitignore"))
54 fs.pop_dir() 48 fs.pop_dir()