Skip to content

Commit

Permalink
fix: helpers.git.checkout_branch from_branch functionality
Browse files Browse the repository at this point in the history
I used to query by default the repo.active_branch.name which will work only if you clone the repo for the first time. But consequitive runs will not. This ensures to query the default branch name from the SCM provider.
  • Loading branch information
alalkamys committed Mar 22, 2024
1 parent b973b08 commit 2315722
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def checkout_branch(repo: Repo, branch_name: str, from_branch: str = None, remot
branch.set_tracking_branch(repo.refs[remote_branch_name])
else:
_logger.info(f"'{branch_name}' doesn't exist, creating..")
from_branch = from_branch or repo.active_branch.name
from_branch = from_branch or get_default_branch_name(repo=repo, remote_name=remote_name)
remote_from_branch = f"{remote_name}/{from_branch}"
if from_branch in repo.branches:
branch = repo.create_head(branch_name, commit=from_branch)
Expand Down

0 comments on commit 2315722

Please sign in to comment.