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 <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2017-06-26 16:07:52 +02:00 committed by Daniel Wagner
parent b911942883
commit 47e8a0730f

View File

@ -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?