aedi: do git pull if not checking out particular commit

This commit is contained in:
alexey.lysiuk 2021-02-18 13:27:35 +02:00
parent 405d1a3b1f
commit 8250875909

View file

@ -78,6 +78,7 @@ class BuildState:
if self.checkout_commit:
checkout_args = (self.checkout_commit,)
need_pull = False
else:
args = ('git', 'show-ref', '--quiet', 'refs/heads/' + branch)
branch_exists = 0 == subprocess.run(args, cwd=self.source).returncode
@ -87,9 +88,15 @@ class BuildState:
else:
checkout_args = ('-b', branch, 'origin/' + branch)
need_pull = True
args = ('git', 'checkout') + checkout_args
subprocess.run(args, cwd=self.source, check=True)
if need_pull:
args = ('git', 'pull')
subprocess.run(args, cwd=self.source, check=True)
def download_source(self, url: str, checksum: str):
if self.external_source:
return