From 3550042c8e54a758e1637489cbfec4d0d8ccc3bc Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Tue, 19 Nov 2024 07:10:54 -0500 Subject: [PATCH] feat: remove more git locks --- joint_teapot/workers/git.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/joint_teapot/workers/git.py b/joint_teapot/workers/git.py index 8c5b278..8c5a81c 100644 --- a/joint_teapot/workers/git.py +++ b/joint_teapot/workers/git.py @@ -85,10 +85,12 @@ def repo_clean_and_checkout( retry_interval = 2 while retry_interval and auto_retry: try: - if clean_git_lock and os.path.exists( - os.path.join(repo_dir, ".git/index.lock") - ): - os.remove(os.path.join(repo_dir, ".git/index.lock")) + if clean_git_lock: + lock_files = ["index.lock", "HEAD.lock", "fetch-pack.lock"] + for lock_file in lock_files: + lock_path = os.path.join(repo_dir, ".git", lock_file) + if os.path.exists(lock_path): + os.remove(lock_path) repo.git.fetch("--tags", "--all", "-f") repo.git.reset("--hard", "origin/master") repo.git.clean("-d", "-f", "-x")