Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
pb8o committed Dec 20, 2023
1 parent 957b9ac commit 059bca9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/framework/ab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,15 @@ def temporary_checkout(revision: str):
happen along the way.
"""
with TemporaryDirectory() as tmp_dir:
basename = Path(tmp_dir).name
# make a temp branch so we can directly check it out
utils.run_cmd("git branch {basename} {revision}")
# `git clone` can take a path instead of an URL, which causes it to create a copy of the
# repository at the given path. However, that path needs to point to the root of a repository,
# it cannot be some arbitrary subdirectory. Therefore:
_, git_root, _ = utils.run_cmd("git rev-parse --show-toplevel")
# split off the '\n' at the end of the stdout
utils.run_cmd(f"git clone {git_root.strip()} {tmp_dir}")

with chdir(tmp_dir):
utils.run_cmd(f"git checkout {revision}")

utils.run_cmd(f"git clone -b {git_root.strip()} {tmp_dir}")
yield Path(tmp_dir)

# If we compiled firecracker inside the checkout, python's recursive shutil.rmdir will
Expand Down

0 comments on commit 059bca9

Please sign in to comment.