From a59bb05fa5c17d9f2b1f94c4fb7c10985675108d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 23 Sep 2010 01:41:49 -0300 Subject: Perform shallow checkout and don't pack .git subdirectory (Changes suggested by Alexander Gladysh) --- src/luarocks/fetch/git.lua | 8 +++++--- 1 file 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) local module = dir.base_name(rockspec.source.url) -- Strip off .git from base name if present module = module:gsub("%.git$", "") - local command = {"git", "clone", rockspec.source.url, module} + local command = {"git", "clone", "--depth=1", rockspec.source.url, module} local checkout_command local tag_or_branch = rockspec.source.tag or rockspec.source.branch if tag_or_branch then @@ -41,13 +41,15 @@ function get_sources(rockspec, extract, dest_dir) if not fs.execute(unpack(command)) then return nil, "Failed fetching files from GIT while cloning." end + fs.change_dir(module) if checkout_command then - fs.change_dir(module) if not fs.execute(unpack(checkout_command)) then return nil, "Failed fetching files from GIT while getting tag/branch." end - fs.pop_dir() end + fs.delete(".git") + fs.delete(".gitignore") + fs.pop_dir() fs.pop_dir() return module, store_dir end -- cgit v1.2.3-55-g6feb