checkout: print a message when switching unborn branches
When we switch to a new branch using checkout, we usually output a message indicating what happened. However, when we switch from an unborn branch to a new branch, we do not print anything, which may leave the user wondering what happened. The reason is that the unborn branch is a special case (see abe1998), and does not follow the usual switch_branches code path. Let's add a similar informational message to the special case to match the usual code path. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Nov 15, 2012 at 09:12 UTC
afa8c07a26b9783c41b1066b75a35de1610a3cfa
1 file changed
+3
builtin/checkout.c
+3
@@ -951,6 +951,9 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
951
strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch);
952
status = create_symref("HEAD", branch_ref.buf, "checkout -b");
953
strbuf_release(&branch_ref);
954
+ if (!opts->quiet)
955
+ fprintf(stderr, _("Switched to a new branch '%s'\n"),
956
+ opts->new_branch);
957
return status;
958
}
959