Skip to content

Commit

Permalink
fix(bisect.py): Fix initial tree creation
Browse files Browse the repository at this point in the history
If linux tree source code doesn't exist (workdir), bisection
will fail due wrong sequence of commands.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Jan 15, 2025
1 parent 70d059c commit 6e41708
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions kcidev/subcommands/bisect.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ def init_bisect(state):
return commitid


def update_tree(workdir, branch, giturl):
if not os.path.exists(workdir):
click.secho(
"Cloning repository (this might take significant time!)", fg="green"
)
repo = Repo.clone_from(giturl, workdir)
repo.git.checkout(branch)
else:
click.secho("Pulling repository", fg="green")
repo = Repo(workdir)
repo.git.checkout(branch)
repo.git.pull()


def bisection_loop(state):
olddir = os.getcwd()
os.chdir(state["workdir"])
Expand Down Expand Up @@ -258,20 +272,11 @@ def bisect(
state["platformfilter"] = platformfilter
state["test"] = test
state["workdir"] = workdir
update_tree(workdir, branch, giturl)
save_state(state, state_file)
else:
print_state(state)

# if workdir doesnt exist, clone the repository
if not os.path.exists(workdir):
click.secho("Cloning repository", fg="green")
repo = Repo.clone_from(giturl, workdir)
repo.git.checkout(branch)
else:
click.secho("Pulling repository", fg="green")
repo = Repo(workdir)
repo.git.checkout(branch)
repo.git.pull()
update_tree(workdir, branch, giturl)

if not state["bisect_init"]:
state["next_commit"] = init_bisect(state)
Expand Down

0 comments on commit 6e41708

Please sign in to comment.