aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fetch.lua2
-rw-r--r--src/luarocks/fetch/git_file.lua17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index bdb448c7..b835b20e 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -302,7 +302,7 @@ function fetch_sources(rockspec, extract, dest_dir)
302 if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then 302 if protocol == "http" or protocol == "https" or protocol == "ftp" or protocol == "file" then
303 proto = require("luarocks.fetch") 303 proto = require("luarocks.fetch")
304 else 304 else
305 ok, proto = pcall(require, "luarocks.fetch."..protocol) 305 ok, proto = pcall(require, "luarocks.fetch."..protocol:gsub("[+-]", "_"))
306 if not ok then 306 if not ok then
307 return nil, "Unknown protocol "..protocol 307 return nil, "Unknown protocol "..protocol
308 end 308 end
diff --git a/src/luarocks/fetch/git_file.lua b/src/luarocks/fetch/git_file.lua
new file mode 100644
index 00000000..1b18d0fa
--- /dev/null
+++ b/src/luarocks/fetch/git_file.lua
@@ -0,0 +1,17 @@
1
2--- Fetch back-end for retrieving sources from local Git repositories.
3module("luarocks.fetch.git_file", package.seeall)
4
5local git = require("luarocks.fetch.git")
6
7--- Fetch sources for building a rock from a local Git repository.
8-- @param rockspec table: The rockspec table
9-- @param extract boolean: Unused in this module (required for API purposes.)
10-- @param dest_dir string or nil: If set, will extract to the given directory.
11-- @return (string, string) or (nil, string): The absolute pathname of
12-- the fetched source tarball and the temporary directory created to
13-- store it; or nil and an error message.
14function get_sources(rockspec, extract, dest_dir)
15 rockspec.source.url = rockspec.source.url:gsub("^git.file://", "")
16 return git.get_sources(rockspec, extract, dest_dir)
17end