From 7ec409a23646f8014fb2b3d20c93d6fd4172e7e7 Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Thu, 14 Jan 2016 06:36:33 -0500 Subject: [PATCH] scm.py: use git clone instead git archive for http(s):// Signed-off-by: Lubos Kocman --- pungi/wrappers/scm.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index b5f47461..f3a57f7e 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -121,6 +121,10 @@ class GitWrapper(ScmBase): self.log_debug("Exporting directory %s from git %s (branch %s)..." % (scm_dir, scm_root, scm_branch)) cmd = "/usr/bin/git archive --remote=%s %s %s | tar xf -" % (pipes.quote(scm_root), pipes.quote(scm_branch), pipes.quote(scm_dir)) + # git archive is not supported by http/https + # or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP + if scm_root.startswith("http"): + cmd = "/usr/bin/git clone --depth 1 --branch=%s %s %s" % (pipes.quote(scm_branch), pipes.quote(scm_root), pipes.quote(tmp_dir)) self.retry_run(cmd, workdir=tmp_dir, show_cmd=True, logfile=log_file) run("cp -a %s/* %s/" % (pipes.quote(os.path.join(tmp_dir, scm_dir)), pipes.quote(target_dir))) @@ -138,6 +142,10 @@ class GitWrapper(ScmBase): self.log_debug("Exporting file %s from git %s (branch %s)..." % (scm_file, scm_root, scm_branch)) cmd = "/usr/bin/git archive --remote=%s %s %s | tar xf -" % (pipes.quote(scm_root), pipes.quote(scm_branch), pipes.quote(scm_file)) + # git archive is not supported by http/https + # or by smart http https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP + if scm_root.startswith("http"): + cmd = "/usr/bin/git clone --depth 1 --branch=%s %s %s" % (pipes.quote(scm_branch), pipes.quote(scm_root), pipes.quote(tmp_dir)) self.retry_run(cmd, workdir=tmp_dir, show_cmd=True, logfile=log_file) makedirs(target_dir)