提交 09a0ec58 编写于 作者: R Ramkumar Ramachandra 提交者: Junio C Hamano

builtin/checkout: Fix message when switching to an existing branch

Fix "Switched to a new branch <name>" to read "Switched to branch
<name>" when <name> corresponds to an existing branch. This bug was
introduced in 02ac9837 while introducing the `-B` switch.

Cc: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: NRamkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c11969de
......@@ -533,10 +533,13 @@ static void update_refs_for_switch(struct checkout_opts *opts,
if (old->path && !strcmp(new->path, old->path))
fprintf(stderr, "Already on '%s'\n",
new->name);
else
else if (opts->new_branch)
fprintf(stderr, "Switched to%s branch '%s'\n",
opts->branch_exists ? " and reset" : " a new",
new->name);
else
fprintf(stderr, "Switched to branch '%s'\n",
new->name);
}
if (old->path && old->name) {
char log_file[PATH_MAX], ref_file[PATH_MAX];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册