# [PATCH] fix a translation error in diff-tree

2 messages from 2015-05-04 to 2015-05-04. Participants: Alangi Derick, Junio C Hamano.
Thread: https://gitlist.dev/t/39232

## Alangi Derick, 2015-05-04 11:22

Subject: [PATCH] fix a translation error in diff-tree
Message-ID: <55476653.e33ac20a.753d.ffffc3cc@mx.google.com>
URL: https://gitlist.dev/e/55476653.e33ac20a.753d.ffffc3cc%40mx.google.com

```
Signed-off-by: Alangi Derick <alangiderick@gmail.com>
---
 builtin/diff-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 12b683d..602b5f9 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -45,7 +45,7 @@ static int stdin_diff_trees(struct tree *tree1, char *line, int len)
 	unsigned char sha1[20];
 	struct tree *tree2;
 	if (len != 82 || !isspace(line[40]) || get_sha1_hex(line + 41, sha1))
-		return error("Need exactly two trees, separated by a space");
+		return error(_("Need exactly two trees, separated by a space"));
 	tree2 = lookup_tree(sha1);
 	if (!tree2 || parse_tree(tree2))
 		return -1;
@@ -75,7 +75,7 @@ static int diff_tree_stdin(char *line)
 		return stdin_diff_commit((struct commit *)obj, line, len);
 	if (obj->type == OBJ_TREE)
 		return stdin_diff_trees((struct tree *)obj, line, len);
-	error("Object %s is a %s, not a commit or tree",
+	error(_("Object %s is a %s, not a commit or tree"),
 	      sha1_to_hex(sha1), typename(obj->type));
 	return -1;
 }
-- 
2.4.0.5.g7a7787e.dirty

```

## Junio C Hamano, 2015-05-04 17:47

Subject: Re: [PATCH] fix a translation error in diff-tree
Message-ID: <xmqqh9rstete.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqh9rstete.fsf%40gitster.dls.corp.google.com
In-Reply-To: <55476653.e33ac20a.753d.ffffc3cc@mx.google.com>

```
Alangi Derick <alangiderick@gmail.com> writes:

[... actually he writes nothing here ;-) ...]

> Signed-off-by: Alangi Derick <alangiderick@gmail.com>
> ---

>> Subject: Re: [PATCH] fix a translation error in diff-tree

Among many ones you sent recently, this title looks the closest in
shape to what SubmittingPatches expects to see.  It however is not
quite there; SubmittingPatches prefers to see an "<area>:" prefix so
that output of "git shortlog --no-merges -100" would give the
readers a better overview of the changes.

When "fix a translation error in diff-tree" appears among 100 other
commits in "git shortlog" output, what kind of change would a reader
imagine this to be, though?

My answer to that question would be: "There was an existing
translation of diff-tree output, that was incorrect in some
unspecified way, and this change corrects that breakage."

And that is not what is going on, so the change is mistitled.
Perhaps

    diff-tree.c: mark error strings for translation

or something, modelling after 8262aaa2 (config.c: mark error and
warnings strings for translation, 2014-08-07), may be more
appropriate.

Having said all that, I do not think we should break scripts by
adding _("") to "git diff-tree" which is a plumbing command whose
output is meant for machine consumption.

>  builtin/diff-tree.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
> index 12b683d..602b5f9 100644
> --- a/builtin/diff-tree.c
> +++ b/builtin/diff-tree.c
> @@ -45,7 +45,7 @@ static int stdin_diff_trees(struct tree *tree1, char *line, int len)
>  	unsigned char sha1[20];
>  	struct tree *tree2;
>  	if (len != 82 || !isspace(line[40]) || get_sha1_hex(line + 41, sha1))
> -		return error("Need exactly two trees, separated by a space");
> +		return error(_("Need exactly two trees, separated by a space"));
>  	tree2 = lookup_tree(sha1);
>  	if (!tree2 || parse_tree(tree2))
>  		return -1;
> @@ -75,7 +75,7 @@ static int diff_tree_stdin(char *line)
>  		return stdin_diff_commit((struct commit *)obj, line, len);
>  	if (obj->type == OBJ_TREE)
>  		return stdin_diff_trees((struct tree *)obj, line, len);
> -	error("Object %s is a %s, not a commit or tree",
> +	error(_("Object %s is a %s, not a commit or tree"),
>  	      sha1_to_hex(sha1), typename(obj->type));
>  	return -1;
>  }

```
