diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-04-12 11:31:39 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-12 11:31:39 -0700 |
| commit | 847af43a3afb39394d5fe58192f94b993ca18f9f (patch) | |
| tree | 178ed69067b4dc0a824eacd0987dbfdfb8bbf2ec /builtin/checkout.c | |
| parent | d8800f630a55264c11693d665846c96caa5a4d1c (diff) | |
| parent | b9f2e1a684e3729b0278950cd7e930441d84c9f1 (diff) | |
| download | git-847af43a3afb39394d5fe58192f94b993ca18f9f.tar.gz | |
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 HEAD
Diffstat (limited to 'builtin/checkout.c')
| -rw-r--r-- | builtin/checkout.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 2b6166c284..947827de1d 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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); } |
