Skip to content

Commit

Permalink
feat: set reset target
Browse files Browse the repository at this point in the history
  • Loading branch information
BoYanZh committed Nov 19, 2024
1 parent 3550042 commit 16028d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion joint_teapot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,10 @@ def joj3_all(
git_push_ok = False
while not git_push_ok:
repo_path = tea.pot.git.repo_clean_and_checkout(
repo_name, "grading", clean_git_lock=True
repo_name,
"grading",
clean_git_lock=True,
reset_target="origin/grading",
)
repo: Repo = tea.pot.git.get_repo(repo_name)
if "grading" not in repo.remote().refs:
Expand Down
4 changes: 3 additions & 1 deletion joint_teapot/workers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ def repo_clean_and_checkout(
self,
repo_name: str,
checkout_dest: str,
*,
auto_retry: bool = True,
clean_git_lock: bool = False,
reset_target: str = "origin/master",
) -> str:
repo_dir = os.path.join(self.repos_dir, repo_name)
repo = self.get_repo(repo_name)
Expand All @@ -92,7 +94,7 @@ def repo_clean_and_checkout(
if os.path.exists(lock_path):
os.remove(lock_path)
repo.git.fetch("--tags", "--all", "-f")
repo.git.reset("--hard", "origin/master")
repo.git.reset("--hard", reset_target)
repo.git.clean("-d", "-f", "-x")
repo.git.checkout(checkout_dest)
retry_interval = 0
Expand Down

0 comments on commit 16028d8

Please sign in to comment.