From 47e8a0730f44242cb6454a1e71d21716f529e8ed Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 26 Jun 2017 16:07:52 +0200 Subject: [PATCH] libkas: Reorder cloning commands and add silent mode consistently The two code paths are unfortunate. Factor out the difference and use a single run_cmd invocation. This also adds the forgotten -q when using a reference directory. Signed-off-by: Jan Kiszka --- kas/libkas.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/kas/libkas.py b/kas/libkas.py index 5e8b147..9fe23a9 100644 --- a/kas/libkas.py +++ b/kas/libkas.py @@ -170,18 +170,11 @@ def repo_fetch(config, repo): gitsrcdir = os.path.join(config.get_repo_ref_dir() or '', repo.qualified_name) logging.debug('Looking for repo ref dir in %s', gitsrcdir) + + cmd = ['/usr/bin/git', 'clone', '-q', repo.url, repo.path] if config.get_repo_ref_dir() and os.path.exists(gitsrcdir): - run_cmd(['/usr/bin/git', - 'clone', - '--reference', gitsrcdir, - repo.url, repo.path], - env=config.environ, - cwd=config.kas_work_dir) - else: - run_cmd(['/usr/bin/git', 'clone', '-q', repo.url, - repo.path], - env=config.environ, - cwd=config.kas_work_dir) + cmd.extend(['--reference', gitsrcdir]) + run_cmd(cmd, env=config.environ, cwd=config.kas_work_dir) return # Does refspec in the current repository?