threads / patch / 30368

patch, 5 partsi18n: TRANSLATORS commends and LEGO--

Subject: [PATCH 0/5] i18n: TRANSLATORS commends and LEGO--

## tl;dr

12 messages between Apr 30, 2012 and Apr 30, 2012. Diffs are folded; open one to read it.

replies: 11people: 2as markdown or json

Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · lore

This series fixes/adds some TRANSLATORS commends and removes lego from some branch/commit messages.

Ævar Arnfjörð Bjarmason (5):
  diff: move TRANSLATORS comments so they're picked up
  i18n: Add more TRANSLATORS comments
  git-branch: remove lego in i18n messages
  git-commit: remove lego in i18n messages
  git-commit: remove lego in i18n messages
 advice.c         |    3 +++
 builtin/branch.c |   24 ++++++++++++--------
 builtin/commit.c |   66 ++++++++++++++++++++++++------------------------------
 bundle.c         |    5 +++++
 commit.c         |    4 ++++
 connected.c      |    3 +++
 diff.c           |   17 +++++++-------
 remote.c         |   10 +++++++++
 sequencer.c      |   10 +++++++++
 9 files changed, 88 insertions(+), 54 deletions(-)
-- 
1.7.10.546.gbaa1a.dirty
Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH 1/5] diff: move TRANSLATORS comments so they're picked up

These TRANSLATORS comments weren't actually picked up by xgettext, the comment needs to be right before the Q_() function call, evidently it isn't picked up if that call is wrapped in another function call.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 diff.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Show changes to diff.c +8 −8
diff --git a/diff.c b/diff.c
index 7da16c9..5d06375 100644
--- a/diff.c
+++ b/diff.c
@@ -1413,22 +1413,22 @@ int print_stat_summary(FILE *fp, int files, int insertions, int deletions)
 	 * but nothing about added/removed lines? Is this a bug in Git?").
 	 */
 	if (insertions || deletions == 0) {
-		/*
-		 * TRANSLATORS: "+" in (+) is a line addition marker;
-		 * do not translate it.
-		 */
 		strbuf_addf(&sb,
+			    /*
+			     * TRANSLATORS: "+" in (+) is a line addition marker;
+			     * do not translate it.
+			     */
 			    Q_(", %d insertion(+)", ", %d insertions(+)",
 			       insertions),
 			    insertions);
 	}
 
 	if (deletions || insertions == 0) {
-		/*
-		 * TRANSLATORS: "-" in (-) is a line removal marker;
-		 * do not translate it.
-		 */
 		strbuf_addf(&sb,
+			    /*
+			     * TRANSLATORS: "-" in (-) is a line removal marker;
+			     * do not translate it.
+			     */
 			    Q_(", %d deletion(-)", ", %d deletions(-)",
 			       deletions),
 			    deletions);
-- 
1.7.10.546.gbaa1a.dirty
Junio C Hamano· Apr 30, 2012, 17:30 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 1/5] diff: move TRANSLATORS comments so they're picked up

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 5 quoted lines
> These TRANSLATORS comments weren't actually picked up by xgettext, the
> comment needs to be right before the Q_() function call, evidently it
> isn't picked up if that call is wrapped in another function call.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

The patch makes sense as an advice to people who update sources where to place the "TRANSLATORS:" comment, but I am unsure about what this particular one says. Are we assuming that translators do not know what the sentence they are translating refers to?

Show 7 quoted lines
>  		strbuf_addf(&sb,
> +			    /*
> +			     * TRANSLATORS: "+" in (+) is a line addition marker;
> +			     * do not translate it.
> +			     */
>  			    Q_(", %d insertion(+)", ", %d insertions(+)",
>  			       insertions),

What I am getting at is that this may be simply being unnecessarily noisy by trying to be helpful, and I am not sure if you are drawing the line at the right level. For example, "insertion" has many meanings and in the context of this sentence it means lines added to the old material---should we mention that here, and tell translators to use the word that conveys that particular meaning?

For this particular one, I'd be happier if the TRANSLATORS comment told them to check if "diffstat" (which we borrowed this from) has a l10n of this message for the language they are translating to, and make sure they use the same format here.

Ævar Arnfjörð Bjarmason· Apr 30, 2012, 17:54 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/5] diff: move TRANSLATORS comments so they're picked up

On Mon, Apr 30, 2012 at 19:30, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> These TRANSLATORS comments weren't actually picked up by xgettext, the
>> comment needs to be right before the Q_() function call, evidently it
>> isn't picked up if that call is wrapped in another function call.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>
> The patch makes sense as an advice to people who update sources where to
> place the "TRANSLATORS:" comment, but I am unsure about what this
> particular one says. Are we assuming that translators do not know what the
> sentence they are translating refers to?

They'd know if they looked at the source, but the reason for moving this is that at the previous location the comment wasn't getting picked up by xgettext.

I.e. before there would be no comment in git.pot and the derived PO file, now there would be, in practice that means that most translators will actually see it.

Show 19 quoted lines
>>               strbuf_addf(&sb,
>> +                         /*
>> +                          * TRANSLATORS: "+" in (+) is a line addition marker;
>> +                          * do not translate it.
>> +                          */
>>                           Q_(", %d insertion(+)", ", %d insertions(+)",
>>                              insertions),
>
> What I am getting at is that this may be simply being unnecessarily noisy
> by trying to be helpful, and I am not sure if you are drawing the line at
> the right level.  For example, "insertion" has many meanings and in the
> context of this sentence it means lines added to the old material---should
> we mention that here, and tell translators to use the word that conveys
> that particular meaning?
>
> For this particular one, I'd be happier if the TRANSLATORS comment told
> them to check if "diffstat" (which we borrowed this from) has a l10n of
> this message for the language they are translating to, and make sure they
> use the same format here.

That makes sense. But for this patch I just wanted to fix things up so that it was placed in the PO file.

Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH 2/5] i18n: Add more TRANSLATORS comments

I took a pass through git.pot and added comments to various messages that could use one, comments still need to be added to a lot of other things, but you have to start somewhere.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 advice.c    |    3 +++
 bundle.c    |    5 +++++
 commit.c    |    4 ++++
 connected.c |    3 +++
 diff.c      |    1 +
 remote.c    |   10 ++++++++++
 sequencer.c |   10 ++++++++++
 7 files changed, 36 insertions(+)
Show changes to 7 files +36 −0

advice.c, bundle.c, commit.c, connected.c, diff.c, remote.c, sequencer.c

diff --git a/advice.c b/advice.c
index a492eea..5944abb 100644
--- a/advice.c
+++ b/advice.c
@@ -37,6 +37,9 @@ void advise(const char *advice, ...)
 
 	for (cp = buf.buf; *cp; cp = np) {
 		np = strchrnul(cp, '\n');
+		/* TRANSLATORS: This will be used to prefix each line of an
+		 * advice message, with the format string being the line
+		 */
 		fprintf(stderr,	_("hint: %.*s\n"), (int)(np - cp), cp);
 		if (*np)
 			np++;
diff --git a/bundle.c b/bundle.c
index 8d31b98..f24999e 100644
--- a/bundle.c
+++ b/bundle.c
@@ -86,6 +86,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
 	int fd = open(path, O_RDONLY);
 
 	if (fd < 0)
+		/* TRANSLATORS: The argument is a path that can't be opened */
 		return error(_("could not open '%s'"), path);
 	return parse_bundle_header(fd, header, path);
 }
@@ -137,6 +138,9 @@ int verify_bundle(struct bundle_header *header, int verbose)
 	struct object_array refs;
 	struct commit *commit;
 	int i, ret = 0, req_nr;
+	/* TRANSLATORS: This is a heading that'll precede a list of commit
+	 * hashes and reference names
+	 */
 	const char *message = _("Repository lacks these prerequisite commits:");
 
 	init_revisions(&revs, NULL);
@@ -412,6 +416,7 @@ int create_bundle(struct bundle_header *header, const char *path,
 		return error(_("pack-objects died"));
 	if (!bundle_to_stdout) {
 		if (commit_lock_file(&lock))
+			/* TRANSLATORS: The argument is a path we can't create */
 			die_errno(_("cannot create '%s'"), path);
 	}
 	return 0;
diff --git a/commit.c b/commit.c
index 9ed36c7..a4ee4b7 100644
--- a/commit.c
+++ b/commit.c
@@ -45,8 +45,12 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n
 {
 	struct commit *c = lookup_commit_reference(sha1);
 	if (!c)
+		/* TRANSLATORS: The argument is a reference name */
 		die(_("could not parse %s"), ref_name);
 	if (hashcmp(sha1, c->object.sha1)) {
+		/* TRANSLATORS: The first argument is a refname, the second is
+		 * a commit hash
+		 */
 		warning(_("%s %s is not a commit!"),
 			ref_name, sha1_to_hex(sha1));
 	}
diff --git a/connected.c b/connected.c
index 1e89c1c..cdd9813 100644
--- a/connected.c
+++ b/connected.c
@@ -45,6 +45,9 @@ int check_everything_connected(sha1_iterate_fn fn, int quiet, void *cb_data)
 		memcpy(commit, sha1_to_hex(sha1), 40);
 		if (write_in_full(rev_list.in, commit, 41) < 0) {
 			if (errno != EPIPE && errno != EINVAL)
+				/* TRANSLATORS: The argument is a strerror()
+				 * message
+				 */
 				error(_("failed write to rev-list: %s"),
 				      strerror(errno));
 			err = -1;
diff --git a/diff.c b/diff.c
index 5d06375..0d4534a 100644
--- a/diff.c
+++ b/diff.c
@@ -3436,6 +3436,7 @@ static int parse_dirstat_opt(struct diff_options *options, const char *params)
 {
 	struct strbuf errmsg = STRBUF_INIT;
 	if (parse_dirstat_params(options, params, &errmsg))
+		/* TRANSLATORS: The argument is an error message */
 		die(_("Failed to parse --dirstat/-X option parameter:\n%s"),
 		    errmsg.buf);
 	strbuf_release(&errmsg);
diff --git a/remote.c b/remote.c
index b296d17..14e7332 100644
--- a/remote.c
+++ b/remote.c
@@ -1604,12 +1604,18 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
 	base = shorten_unambiguous_ref(base, 0);
 	if (!num_theirs)
 		strbuf_addf(sb,
+			/* TRANSLATORS: the first argument is a branch name, the
+			 * second is a count of how many commits we're ahead of it
+			 */
 			Q_("Your branch is ahead of '%s' by %d commit.\n",
 			   "Your branch is ahead of '%s' by %d commits.\n",
 			   num_ours),
 			base, num_ours);
 	else if (!num_ours)
 		strbuf_addf(sb,
+			/* TRANSLATORS: the first argument is a branch name, the
+			 * second is a count of how many commits we're behind it
+			 */
 			Q_("Your branch is behind '%s' by %d commit, "
 			       "and can be fast-forwarded.\n",
 			   "Your branch is behind '%s' by %d commits, "
@@ -1618,6 +1624,10 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
 			base, num_theirs);
 	else
 		strbuf_addf(sb,
+			/* TRANSLATORS: the first argument is a branch name, the
+			 * second and third arguments are counts of how many
+			 * commits they've diverged by
+			 */
 			Q_("Your branch and '%s' have diverged,\n"
 			       "and have %d and %d different commit each, "
 			       "respectively.\n",
diff --git a/sequencer.c b/sequencer.c
index f83cdfd..b284cf8 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -118,8 +118,14 @@ static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)
 	filename = git_path("%s", pseudoref);
 	fd = open(filename, O_WRONLY | O_CREAT, 0666);
 	if (fd < 0)
+		/* TRANSLATORS: The argument is a filename that can't be
+		 * opened for writing
+		 */
 		die_errno(_("Could not open '%s' for writing"), filename);
 	if (write_in_full(fd, buf.buf, buf.len) != buf.len || close(fd))
+		/* TRANSLATORS: The argument is a filename that can't be
+		 * opened for writing
+		 */
 		die_errno(_("Could not write to '%s'"), filename);
 	strbuf_release(&buf);
 }
@@ -157,6 +163,9 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
 	int msg_fd = hold_lock_file_for_update(&msg_file, filename,
 					       LOCK_DIE_ON_ERROR);
 	if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
+		/* TRANSLATORS: The argument is a filename that can't be
+		 * written to
+		 */
 		die_errno(_("Could not write to %s"), filename);
 	strbuf_release(msgbuf);
 	if (commit_lock_file(&msg_file) < 0)
@@ -365,6 +374,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
 		struct commit_list *p;
 
 		if (!opts->mainline)
+			/* TRANSLATORS: The argument is a commit digest */
 			return error(_("Commit %s is a merge but no -m option was given."),
 				sha1_to_hex(commit->object.sha1));
 
-- 
1.7.10.546.gbaa1a.dirty
Junio C Hamano· Apr 30, 2012, 17:37 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 2/5] i18n: Add more TRANSLATORS comments

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 26 quoted lines
> I took a pass through git.pot and added comments to various messages
> that could use one, comments still need to be added to a lot of other
> things, but you have to start somewhere.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  advice.c    |    3 +++
>  bundle.c    |    5 +++++
>  commit.c    |    4 ++++
>  connected.c |    3 +++
>  diff.c      |    1 +
>  remote.c    |   10 ++++++++++
>  sequencer.c |   10 ++++++++++
>  7 files changed, 36 insertions(+)
>
> diff --git a/advice.c b/advice.c
> index a492eea..5944abb 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -37,6 +37,9 @@ void advise(const char *advice, ...)
>  
>  	for (cp = buf.buf; *cp; cp = np) {
>  		np = strchrnul(cp, '\n');
> +		/* TRANSLATORS: This will be used to prefix each line of an
> +		 * advice message, with the format string being the line
> +		 */
	/*
         * Our multi-line comments are formatted like
         * this (many other places in the patch).
         */

Also end the sentence with a full-stop, please (many other places in the patch).

It is unclear what "with the format string being the line" means here, at least to me, even though I think I wrote this code.

Show 13 quoted lines
>  		fprintf(stderr,	_("hint: %.*s\n"), (int)(np - cp), cp);
>  		if (*np)
>  			np++;
> diff --git a/bundle.c b/bundle.c
> index 8d31b98..f24999e 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -86,6 +86,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
>  	int fd = open(path, O_RDONLY);
>  
>  	if (fd < 0)
> +		/* TRANSLATORS: The argument is a path that can't be opened */
>  		return error(_("could not open '%s'"), path);

That does not add much information. "path to the file we tried to read the bundle data from but failed"?

Show 7 quoted lines
> @@ -137,6 +138,9 @@ int verify_bundle(struct bundle_header *header, int verbose)
>  	struct object_array refs;
>  	struct commit *commit;
>  	int i, ret = 0, req_nr;
> +	/* TRANSLATORS: This is a heading that'll precede a list of commit
> +	 * hashes and reference names
> +	 */
Please say "commit object names" (many other places in the patch).
Show 9 quoted lines
>  	const char *message = _("Repository lacks these prerequisite commits:");
>  
>  	init_revisions(&revs, NULL);
> @@ -412,6 +416,7 @@ int create_bundle(struct bundle_header *header, const char *path,
>  		return error(_("pack-objects died"));
>  	if (!bundle_to_stdout) {
>  		if (commit_lock_file(&lock))
> +			/* TRANSLATORS: The argument is a path we can't create */
>  			die_errno(_("cannot create '%s'"), path);

That does not add much information. "path to the file we tried to write the bundle data to but failed"?

Show 5 quoted lines
> @@ -365,6 +374,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
>  		struct commit_list *p;
>  
>  		if (!opts->mainline)
> +			/* TRANSLATORS: The argument is a commit digest */
Please consistently say "commit object name".
>  			return error(_("Commit %s is a merge but no -m option was given."),
>  				sha1_to_hex(commit->object.sha1));
Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH 3/5] git-branch: remove lego in i18n messages

Instead of making translators translate "remote " and then using "%sbranch" where "%s" is either "remote " or "" just split the two up into separate messages. This makes the translation of this section of git-branch much less confusing.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/branch.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
Show changes to builtin/branch.c +15 −9
diff --git a/builtin/branch.c b/builtin/branch.c
index 5f150b4..8813d2e 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -152,21 +152,22 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
 	struct commit *rev, *head_rev = NULL;
 	unsigned char sha1[20];
 	char *name = NULL;
-	const char *fmt, *remote;
+	const char *fmt;
 	int i;
 	int ret = 0;
+	int remote_branch = 0;
 	struct strbuf bname = STRBUF_INIT;
 
 	switch (kinds) {
 	case REF_REMOTE_BRANCH:
 		fmt = "refs/remotes/%s";
-		/* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
-		remote = _("remote ");
+		/* For subsequent UI messages */
+		remote_branch = 1;
+
 		force = 1;
 		break;
 	case REF_LOCAL_BRANCH:
 		fmt = "refs/heads/%s";
-		remote = "";
 		break;
 	default:
 		die(_("cannot use -a with -d"));
@@ -190,8 +191,9 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
 
 		name = xstrdup(mkpath(fmt, bname.buf));
 		if (read_ref(name, sha1)) {
-			error(_("%sbranch '%s' not found."),
-					remote, bname.buf);
+			error(remote_branch
+			      ? _("remote branch '%s' not found.")
+			      : _("branch '%s' not found."), bname.buf);
 			ret = 1;
 			continue;
 		}
@@ -212,14 +214,18 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
 		}
 
 		if (delete_ref(name, sha1, 0)) {
-			error(_("Error deleting %sbranch '%s'"), remote,
+			error(remote_branch
+			      ? _("Error deleting remote branch '%s'")
+			      : _("Error deleting branch '%s'"),
 			      bname.buf);
 			ret = 1;
 		} else {
 			struct strbuf buf = STRBUF_INIT;
 			if (!quiet)
-				printf(_("Deleted %sbranch %s (was %s).\n"),
-				       remote, bname.buf,
+				printf(remote_branch
+				       ? _("Deleted remote branch %s (was %s).\n")
+				       : _("Deleted branch %s (was %s).\n"),
+				       bname.buf,
 				       find_unique_abbrev(sha1, DEFAULT_ABBREV));
 			strbuf_addf(&buf, "branch.%s", bname.buf);
 			if (git_config_rename_section(buf.buf, NULL) < 0)
-- 
1.7.10.546.gbaa1a.dirty
Junio C Hamano· Apr 30, 2012, 17:38 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 3/5] git-branch: remove lego in i18n messages

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 7 quoted lines
> Instead of making translators translate "remote " and then using
> "%sbranch" where "%s" is either "remote " or "" just split the two up
> into separate messages. This makes the translation of this section of
> git-branch much less confusing.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
Looks good.
Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH 4/5] git-commit: remove lego in i18n messages

Remove the whence_s() function and messages that dependen on it in favor of messages that use either "merge" or "cherry-pick" directly.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/commit.c |   52 +++++++++++++++++++++++-----------------------------
 1 file changed, 23 insertions(+), 29 deletions(-)
Show changes to builtin/commit.c +23 −29
diff --git a/builtin/commit.c b/builtin/commit.c
index b257ae8..c7c491e 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -194,24 +194,6 @@ static void determine_whence(struct wt_status *s)
 		s->whence = whence;
 }
 
-static const char *whence_s(void)
-{
-	const char *s = "";
-
-	switch (whence) {
-	case FROM_COMMIT:
-		break;
-	case FROM_MERGE:
-		s = _("merge");
-		break;
-	case FROM_CHERRY_PICK:
-		s = _("cherry-pick");
-		break;
-	}
-
-	return s;
-}
-
 static void rollback_index_files(void)
 {
 	switch (commit_style) {
@@ -453,8 +435,12 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
 	 */
 	commit_style = COMMIT_PARTIAL;
 
-	if (whence != FROM_COMMIT)
-		die(_("cannot do a partial commit during a %s."), whence_s());
+	if (whence != FROM_COMMIT) {
+		if (whence == FROM_MERGE)
+			die(_("cannot do a partial commit during a merge."));
+		else if (whence == FROM_CHERRY_PICK)
+			die(_("cannot do a partial commit during a cherry-pick."));
+	}
 
 	memset(&partial, 0, sizeof(partial));
 	partial.strdup_strings = 1;
@@ -796,13 +782,17 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		char *ai_tmp, *ci_tmp;
 		if (whence != FROM_COMMIT)
 			status_printf_ln(s, GIT_COLOR_NORMAL,
-				_("\n"
-				"It looks like you may be committing a %s.\n"
-				"If this is not correct, please remove the file\n"
-				"	%s\n"
-				"and try again.\n"
-				""),
-				whence_s(),
+			    whence == FROM_MERGE
+				? _("\n"
+					"It looks like you may be committing a merge.\n"
+					"If this is not correct, please remove the file\n"
+					"	%s\n"
+					"and try again.\n")
+				: _("\n"
+					"It looks like you may be committing a cherry-pick.\n"
+					"If this is not correct, please remove the file\n"
+					"	%s\n"
+					"and try again.\n"),
 				git_path(whence == FROM_MERGE
 					 ? "MERGE_HEAD"
 					 : "CHERRY_PICK_HEAD"));
@@ -1072,8 +1062,12 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	/* Sanity check options */
 	if (amend && !current_head)
 		die(_("You have nothing to amend."));
-	if (amend && whence != FROM_COMMIT)
-		die(_("You are in the middle of a %s -- cannot amend."), whence_s());
+	if (amend && whence != FROM_COMMIT) {
+		if (whence == FROM_MERGE)
+			die(_("You are in the middle of a merge -- cannot amend."));
+		else if (whence == FROM_CHERRY_PICK)
+			die(_("You are in the middle of a cherry-pick -- cannot amend."));
+	}
 	if (fixup_message && squash_message)
 		die(_("Options --squash and --fixup cannot be used together"));
 	if (use_message)
-- 
1.7.10.546.gbaa1a.dirty
Ævar Arnfjörð Bjarmason· Apr 30, 2012, 15:33 UTC · re: Ævar Arnfjörð Bjarmason · lore

[PATCH 5/5] git-commit: remove lego in i18n messages

Change the "Please enter the commit message for your changes." and the subsequent blurb of text not to be split up. This makes translating it much easier.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/commit.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
Show changes to builtin/commit.c +6 −8
diff --git a/builtin/commit.c b/builtin/commit.c
index c7c491e..438f257 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -798,17 +798,15 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 					 : "CHERRY_PICK_HEAD"));
 
 		fprintf(s->fp, "\n");
-		status_printf(s, GIT_COLOR_NORMAL,
-			_("Please enter the commit message for your changes."));
 		if (cleanup_mode == CLEANUP_ALL)
-			status_printf_more(s, GIT_COLOR_NORMAL,
-				_(" Lines starting\n"
-				"with '#' will be ignored, and an empty"
+			status_printf(s, GIT_COLOR_NORMAL,
+				_("Please enter the commit message for your changes."
+				" Lines starting\nwith '#' will be ignored, and an empty"
 				" message aborts the commit.\n"));
 		else /* CLEANUP_SPACE, that is. */
-			status_printf_more(s, GIT_COLOR_NORMAL,
-				_(" Lines starting\n"
-				"with '#' will be kept; you may remove them"
+			status_printf(s, GIT_COLOR_NORMAL,
+				_("Please enter the commit message for your changes."
+				" Lines starting\nwith '#' will be kept; you may remove them"
 				" yourself if you want to.\n"
 				"An empty message aborts the commit.\n"));
 		if (only_include_assumed)
-- 
1.7.10.546.gbaa1a.dirty

← back to recent threads