From 82508759094b4fad73e006c3e9c347160a6cddf4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 18 Feb 2021 13:27:35 +0200 Subject: [PATCH] aedi: do git pull if not checking out particular commit --- aedi/state.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aedi/state.py b/aedi/state.py index 1e9fbcd0..e58efff2 100644 --- a/aedi/state.py +++ b/aedi/state.py @@ -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