respect branch if specified on command line (#44491)

This commit is contained in:
Frédéric Péters 2020-06-26 12:30:22 +02:00
parent f7fc82a4cb
commit 6704539ab5
1 changed files with 4 additions and 1 deletions

View File

@ -441,7 +441,7 @@ def setup_git_tree(project_reference, options):
shutil.rmtree(git_project_path)
if os.path.exists(git_project_path):
existing_tree = True
branch_name = get_git_branch_name(project_reference)
branch_name = options.branch or get_git_branch_name(project_reference)
try:
subprocess.check_call(['git', 'checkout', '--quiet', branch_name],
cwd=git_project_path)
@ -463,6 +463,9 @@ def setup_git_tree(project_reference, options):
else:
project_url = project_reference
call("git clone %s" % project_url)
if options.branch:
subprocess.check_call(['git', 'checkout', '--quiet', branch_name],
cwd=git_project_path)
branch_name = get_git_branch_name(project_reference)
if not options.branch: