aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fetch/git.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index d2420ef8..f2f17fb5 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -21,7 +21,7 @@ function get_sources(rockspec, extract, dest_dir)
21 local module = dir.base_name(rockspec.source.url) 21 local module = dir.base_name(rockspec.source.url)
22 -- Strip off .git from base name if present 22 -- Strip off .git from base name if present
23 module = module:gsub("%.git$", "") 23 module = module:gsub("%.git$", "")
24 local command = {"git", "clone", rockspec.source.url, module} 24 local command = {"git", "clone", "--depth=1", rockspec.source.url, module}
25 local checkout_command 25 local checkout_command
26 local tag_or_branch = rockspec.source.tag or rockspec.source.branch 26 local tag_or_branch = rockspec.source.tag or rockspec.source.branch
27 if tag_or_branch then 27 if tag_or_branch then
@@ -41,13 +41,15 @@ function get_sources(rockspec, extract, dest_dir)
41 if not fs.execute(unpack(command)) then 41 if not fs.execute(unpack(command)) then
42 return nil, "Failed fetching files from GIT while cloning." 42 return nil, "Failed fetching files from GIT while cloning."
43 end 43 end
44 fs.change_dir(module)
44 if checkout_command then 45 if checkout_command then
45 fs.change_dir(module)
46 if not fs.execute(unpack(checkout_command)) then 46 if not fs.execute(unpack(checkout_command)) then
47 return nil, "Failed fetching files from GIT while getting tag/branch." 47 return nil, "Failed fetching files from GIT while getting tag/branch."
48 end 48 end
49 fs.pop_dir()
50 end 49 end
50 fs.delete(".git")
51 fs.delete(".gitignore")
52 fs.pop_dir()
51 fs.pop_dir() 53 fs.pop_dir()
52 return module, store_dir 54 return module, store_dir
53end 55end