In case the checkout is executed with --update and the commit of a repo
is pinned (directly via the config, not via a lockfile), we can safely
skip the fetching if we already have that commit. This slightly speeds
the checkout up as no irrelevant fetch is executed in this case.
Closes: #164
Signed-off-by: Felix Moessbauer <
felix.mo...@siemens.com>
---
kas/repos.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kas/repos.py b/kas/repos.py
index 187f94305..4b6ff440f 100644
--- a/kas/repos.py
+++ b/kas/repos.py
@@ -406,7 +406,10 @@ class RepoImpl(Repo):
and self.refspec is None:
return 0
- if not get_context().update:
+ # check if we already have the commit. On update, check as well in case
+ # the commit is fixed, hence the repo must not be updated anyways
+ force_update = get_context().update
+ if not force_update or (force_update and self.commit):
# Do commit/tag/branch/refspec exist in the current repository?
(retc, output) = await run_cmd_async(self.contains_refspec_cmd(),
cwd=self.path,
--
2.51.0