repos: Fix cloning of repos without default branch

Handle gracefully the case that a repo has no branch checked out after
cloning.

Reported-by: Claudius Heine <ch@denx.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2020-05-29 14:33:09 +02:00
parent 116853cbb4
commit e41d5af76b

View File

@ -231,9 +231,9 @@ class RepoImpl(Repo):
# Check if current HEAD is what in the config file is defined.
(_, output) = run_cmd(self.current_rev_cmd(),
cwd=self.path)
cwd=self.path, fail=False)
if output.strip() == self.refspec:
if output and output.strip() == self.refspec:
logging.info('Repo %s has already been checked out with correct '
'refspec. Nothing to do.', self.name)
return