summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-11-15 17:12:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-11-16 01:36:26 (GMT)
commitafa8c07a26b9783c41b1066b75a35de1610a3cfa (patch)
tree29e7880abe604475d222151cc4a3cfc9bcd83521
parent8c7a786b6c8eae8eac91083cdc9a6e337bc133b0 (diff)
downloadgit-afa8c07a26b9783c41b1066b75a35de1610a3cfa.zip
git-afa8c07a26b9783c41b1066b75a35de1610a3cfa.tar.gz
git-afa8c07a26b9783c41b1066b75a35de1610a3cfa.tar.bz2
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>
-rw-r--r--builtin/checkout.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 781295b..a9c1b5a 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -951,6 +951,9 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch);
status = create_symref("HEAD", branch_ref.buf, "checkout -b");
strbuf_release(&branch_ref);
+ if (!opts->quiet)
+ fprintf(stderr, _("Switched to a new branch '%s'\n"),
+ opts->new_branch);
return status;
}