branch: support more tracking modes when recursing
commit75388bf5b47678c95f24b58007d2b37d744bf0f7
authorGlen Choo <chooglen@google.com>
Tue, 29 Mar 2022 20:01:16 +0000 (29 20:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Mar 2022 20:40:00 +0000 (30 13:40 -0700)
tree50d19e2c31589511150e44385974bea0fd62ee23
parent679e3693aba0c17af60c031f7eef68f2296b8dad
branch: support more tracking modes when recursing

"git branch --recurse-submodules" does not propagate "--track=inherit"
or "--no-track" to submodules, which causes submodule branches to use
the wrong tracking mode [1]. To fix this, pass the correct options to
the "submodule--helper create-branch" child process and test for it.

While we are refactoring the same code, replace "--track" with the
synonymous, but more consistent-looking "--track=direct" option
(introduced at the same time as "--track=inherit", d3115660b4 (branch:
add flags and config to inherit tracking, 2021-12-20)).

[1] This bug is partially a timing issue: "branch --recurse-submodules"
 was introduced around the same time as "--track=inherit", and even
 though I rebased "branch --recurse-submodules" on top of that, I had
 neglected to support the new tracking mode. Omitting "--no-track"
 was just a plain old mistake, though.

Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c
builtin/submodule--helper.c
t/t3207-branch-submodule.sh