diff options
author | mpeterv <mpeterval@gmail.com> | 2015-06-25 14:14:16 +0300 |
---|---|---|
committer | mpeterv <mpeterval@gmail.com> | 2015-06-26 15:43:46 +0300 |
commit | 1e9edc66b768ad9e78401cf51931967430de1f7b (patch) | |
tree | 679630f4c9f9fa71e53d67b2cfc6d76d8fd22383 /src/luarocks/fetch/git.lua | |
parent | d8a72ee125aa0acfa8d43b910572edfcc61cd434 (diff) | |
download | luarocks-1e9edc66b768ad9e78401cf51931967430de1f7b.tar.gz luarocks-1e9edc66b768ad9e78401cf51931967430de1f7b.tar.bz2 luarocks-1e9edc66b768ad9e78401cf51931967430de1f7b.zip |
Check that rockspec format is at least 3.0 before fetching submodules
For utility, add deps.format_is_at_least(rockspec, version) function.
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/fetch/git.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index 0847f735..ce41659b 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua | |||
@@ -110,15 +110,18 @@ function git.get_sources(rockspec, extract, dest_dir, depth) | |||
110 | end | 110 | end |
111 | end | 111 | end |
112 | 112 | ||
113 | command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"} | 113 | -- Fetching git submodules is supported only when rockspec format is >= 3.0. |
114 | if deps.format_is_at_least(rockspec, "3.0") then | ||
115 | command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"} | ||
114 | 116 | ||
115 | if git_supports_shallow_submodules(git_cmd) then | 117 | if git_supports_shallow_submodules(git_cmd) then |
116 | -- Fetch only the last commit of each submodule. | 118 | -- Fetch only the last commit of each submodule. |
117 | table.insert(command, 5, "--depth=1") | 119 | table.insert(command, 5, "--depth=1") |
118 | end | 120 | end |
119 | 121 | ||
120 | if not fs.execute(unpack(command)) then | 122 | if not fs.execute(unpack(command)) then |
121 | return nil, 'Failed to fetch submodules.' | 123 | return nil, 'Failed to fetch submodules.' |
124 | end | ||
122 | end | 125 | end |
123 | 126 | ||
124 | fs.delete(dir.path(store_dir, module, ".git")) | 127 | fs.delete(dir.path(store_dir, module, ".git")) |