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 From d051ad5a21b653dbc5845900b5c4e734d92073c1 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 23 Sep 2010 01:42:50 -0300 Subject: Enable luarocks-admin remove --- src/bin/luarocks-admin | 1 + src/luarocks/add.lua | 2 +- src/luarocks/admin_remove.lua | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/luarocks-admin b/src/bin/luarocks-admin index 6e528cd9..69814459 100755 --- a/src/bin/luarocks-admin +++ b/src/bin/luarocks-admin @@ -11,6 +11,7 @@ commands = { commands.help = require("luarocks.help") commands.make_manifest = require("luarocks.make_manifest") commands.add = require("luarocks.add") +commands.remove = require("luarocks.admin_remove") commands.refresh_cache = require("luarocks.refresh_cache") command_line.run_command(...) diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index 61d44665..a6dc4531 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua @@ -91,7 +91,7 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server) -- TODO abstract away explicit 'curl' call local cmd - if upload_server and upload_server.rsync then + if protocol == "rsync" then local srv, path = server_path:match("([^/]+)(/.+)") cmd = "rsync -Oavz -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" elseif upload_server and upload_server.sftp then diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index 1b1f845c..99852e36 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua @@ -74,7 +74,7 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve index.make_index(local_cache) local srv, path = server_path:match("([^/]+)(/.+)") - local cmd = "rsync -Oavz -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" + local cmd = "rsync -Oavz --delete -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" print(cmd) fs.execute(cmd) -- cgit v1.2.3-55-g6feb