Skip to content

Commit

Permalink
Git: allow force_run to be false in checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgov committed Oct 14, 2024
1 parent 8c01c28 commit 4c0fd46
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lisa/tools/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ def clone(
return full_path

def checkout(
self, ref: str, cwd: pathlib.PurePath, checkout_branch: str = ""
self,
ref: str,
cwd: pathlib.PurePath,
checkout_branch: str = "",
force_run: bool = True,
) -> None:
if not checkout_branch:
# create a temp branch to checkout tag or commit.
Expand All @@ -115,15 +119,15 @@ def checkout(
# force run to make sure checkout among branches correctly.
result = self.run(
f"checkout {ref}",
force_run=True,
force_run=force_run,
cwd=cwd,
no_info_log=True,
no_error_log=True,
)

result = self.run(
f"checkout -b {checkout_branch}",
force_run=True,
force_run=force_run,
cwd=cwd,
no_info_log=True,
no_error_log=True,
Expand All @@ -134,7 +138,7 @@ def checkout(
# in case there is submodule.
self.run(
"submodule update",
force_run=True,
force_run=force_run,
cwd=cwd,
no_info_log=True,
)
Expand Down

0 comments on commit 4c0fd46

Please sign in to comment.