From c3c940d202e45002832390e5ee484bf18571629b Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Thu, 26 Oct 2023 08:22:35 +0300 Subject: [PATCH] fix(reharden): --clone should also update existing repos --- reharden.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reharden.py b/reharden.py index 4817f2e..3a85829 100644 --- a/reharden.py +++ b/reharden.py @@ -189,6 +189,13 @@ if __name__ == "__main__": cloned_repo = git.Repo(repo_dir) cloned_repo.git.submodule("update", "--init") cloned_repo.git.checkout(commit) + else: + cloned_repo = git.Repo(repo_dir) + if commit != cloned_repo.commit().hexsha: + logging.info(f"updating {number :03} {repo} to commit {commit}") + cloned_repo.git.fetch("origin") + cloned_repo.git.checkout(commit) + cloned_repo.git.submodule("update", "--init") # get tt tools setup. # can't run tt from another directory because gitpython fails