branch: add a dry_run parameter to create_branch()

Add a dry_run parameter to create_branch() such that dry_run = 1 will
validate a new branch without trying to create it. This will be used in
`git branch --recurse-submodules` to ensure that the new branch can be
created in all submodules.

Signed-off-by: Glen Choo <chooglen@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Glen Choo
2022-01-28 16:04:43 -08:00
committed by Junio C Hamano
parent bc0893cf3b
commit 3f3e76082b
4 changed files with 11 additions and 4 deletions

View File

@ -893,7 +893,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
opts->new_branch_force ? 1 : 0,
opts->new_branch_log,
opts->quiet,
opts->track);
opts->track,
0);
new_branch_info->name = opts->new_branch;
setup_branch_path(new_branch_info);
}