From: Ramkumar Ramachandra Date: Fri, 20 Aug 2010 17:41:47 +0000 (+0530) Subject: builtin/checkout: Fix message when switching to an existing branch X-Git-Tag: v1.7.3-rc0~59 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=09a0ec58ce57413dcb2b2cfb4b4ece11ad616e7b;p=git.git builtin/checkout: Fix message when switching to an existing branch Fix "Switched to a new branch " to read "Switched to branch " when corresponds to an existing branch. This bug was introduced in 02ac983 while introducing the `-B` switch. Cc: Tay Ray Chuan Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- diff --git a/builtin/checkout.c b/builtin/checkout.c index 1f7e1546f..7f81120c7 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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];