def git_clone_repo(git_url, repo_dir)
repo_dir = (repo_dir ? " \"#{repo_dir}\"" : "")
clone_cmd = "git clone #{git_url}#{repo_dir}"
debug "Running #{clone_cmd}"
err = nil
if RHC::Helpers.windows?
output = %x[#{clone_cmd} 2>&1]
if $?.exitstatus != 0
err = output + " - Check to make sure you have correctly installed git and it is added to your path."
else
say output
end
else
paragraph do
Open4.popen4(clone_cmd) do |pid, stdin, stdout, stderr|
stdin.close
say stdout.read
err = stderr.read
end
say "done"
end
end
raise RHC::GitException, "Error in git clone - #{err}" if $?.exitstatus != 0
end