diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-23 01:41:49 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-23 01:41:49 -0300 |
commit | a59bb05fa5c17d9f2b1f94c4fb7c10985675108d (patch) | |
tree | 10055f09ebaaa8575a8a07b14ebe179005a57e29 | |
parent | 885f344eec59d0e56aa244b8a490ef7c29f72129 (diff) | |
download | luarocks-a59bb05fa5c17d9f2b1f94c4fb7c10985675108d.tar.gz luarocks-a59bb05fa5c17d9f2b1f94c4fb7c10985675108d.tar.bz2 luarocks-a59bb05fa5c17d9f2b1f94c4fb7c10985675108d.zip |
Perform shallow checkout and don't pack .git subdirectory
(Changes suggested by Alexander Gladysh)
-rw-r--r-- | src/luarocks/fetch/git.lua | 8 |
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 |
53 | end | 55 | end |