Subject: Re: [PATCH v4 24/73] gettextize: git-checkout "Switched to a .. branch" message

From: Jonathan Nieder <[email-masked]>
Date: Fri, 25 Feb 2011 02:10:48 -0600

Ævar Arnfjörð Bjarmason wrote:

> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -550,9 +550,10 @@ static void update_refs_for_switch(struct checkout_opts *opts,
>  				fprintf(stderr, _("Already on '%s'\n"),
>  					new->name);
>  			else if (opts->new_branch)
> -				fprintf(stderr, "Switched to%s branch '%s'\n",
> -					opts->branch_exists ? " and reset" : " a new",
> -					new->name);
> +				if (opts->branch_exists)
> +					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
> +				else
> +					fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
>  			else

C grammar is on your side, but the following seems worthwhile for
the sanity of readers and those who might modify the code in the
future.
---
 builtin/checkout.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 92049cb..fc727ce 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -553,17 +553,18 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 	if (new->path) {
 		create_symref("HEAD", new->path, msg.buf);
 		if (!opts->quiet) {
-			if (old->path && !strcmp(new->path, old->path))
+			if (old->path && !strcmp(new->path, old->path)) {
 				fprintf(stderr, _("Already on '%s'\n"),
 					new->name);
-			else if (opts->new_branch)
+			} else if (opts->new_branch) {
 				if (opts->branch_exists)
 					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
 				else
 					fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
-			else
+			} else {
 				fprintf(stderr, _("Switched to branch '%s'\n"),
 					new->name);
+			}
 		}
 		if (old->path && old->name) {
 			char log_file[PATH_MAX], ref_file[PATH_MAX];
-- 
1.7.4.1