From 83449f223ce59695bbd628abb0fb6c418a713c0f Mon Sep 17 00:00:00 2001 From: Ignacio BurgueƱo Date: Wed, 17 Jun 2015 13:00:29 -0300 Subject: Checks if git is installed When sources are to be fetched using git, check beforehand it is available in the path instead of causing an error. It will show the message: `Error: 'git' program not found. Is git installed? You may want to edit variables.GIT` and exit. refs #381 --- src/luarocks/fetch/git.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index 53fd4445..bea53fc8 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua @@ -40,6 +40,10 @@ function git.get_sources(rockspec, extract, dest_dir, depth) -- Strip off .git from base name if present module = module:gsub("%.git$", "") + if not fs.execute_quiet(git_cmd, "--version") then + return nil, "'"..git_cmd.."' program not found. Is git installed? You may want to edit variables.GIT" + end + local store_dir if not dest_dir then store_dir = fs.make_temp_dir(name_version) -- cgit v1.2.3-55-g6feb