Merge branch 'jc/checkout-detach-wo-tracking-report'
"git checkout/switch --detach foo", after switching to the detached HEAD state, gave the tracking information for the 'foo' branch, which was pointless. Tested-by: M Hickford <mirth.hickford@gmail.com> cf. <CAGJzqsmE9FDEBn=u3ge4LA3ha4fDbm4OWiuUbMaztwjELBd7ug@mail.gmail.com> * jc/checkout-detach-wo-tracking-report: checkout: omit "tracking" information on a detached HEADmaint
commit
847af43a3a
|
@ -1035,7 +1035,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
|||
remove_branch_state(the_repository, !opts->quiet);
|
||||
strbuf_release(&msg);
|
||||
if (!opts->quiet &&
|
||||
(new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD"))))
|
||||
!opts->force_detach &&
|
||||
(new_branch_info->path || !strcmp(new_branch_info->name, "HEAD")))
|
||||
report_tracking(new_branch_info);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,10 @@ test_expect_success 'tracking count is accurate after orphan check' '
|
|||
git config branch.child.merge refs/heads/main &&
|
||||
git checkout child^ &&
|
||||
git checkout child >stdout &&
|
||||
test_cmp expect stdout
|
||||
test_cmp expect stdout &&
|
||||
|
||||
git checkout --detach child >stdout &&
|
||||
test_grep ! "can be fast-forwarded\." stdout
|
||||
'
|
||||
|
||||
test_expect_success 'no advice given for explicit detached head state' '
|
||||
|
|
Loading…
Reference in New Issue