[v2,03/16] archive.c: mark more strings for translation
diff mbox series

Message ID 20181105192059.20303-4-pclouds@gmail.com
State New
Headers show
Series
  • Mark more strings for translation
Related show

Commit Message

Duy Nguyen Nov. 5, 2018, 7:20 p.m. UTC
Two messages also print extra information to be more useful

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 archive.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Junio C Hamano Nov. 6, 2018, 2:09 a.m. UTC | #1
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> Two messages also print extra information to be more useful
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  archive.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/archive.c b/archive.c
> index 9d16b7fadf..d8f6e1ce30 100644
> --- a/archive.c
> +++ b/archive.c
> @@ -385,12 +385,12 @@ static void parse_treeish_arg(const char **argv,
>  		int refnamelen = colon - name;
>  
>  		if (!dwim_ref(name, refnamelen, &oid, &ref))
> -			die("no such ref: %.*s", refnamelen, name);
> +			die(_("no such ref: %.*s"), refnamelen, name);
>  		free(ref);
>  	}
>  
>  	if (get_oid(name, &oid))
> -		die("Not a valid object name");
> +		die(_("not a valid object name: %s"), name);

Much better than the previous one that gave the name upfront.

>  
>  	commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
>  	if (commit) {
> @@ -403,7 +403,7 @@ static void parse_treeish_arg(const char **argv,
>  
>  	tree = parse_tree_indirect(&oid);
>  	if (tree == NULL)
> -		die("not a tree object");
> +		die(_("not a tree object: %s"), oid_to_hex(&oid));

Likewise; as oid_to_hex() would be quite long compared to the rest
of the message, this is a vast improvement from the previous round.

>  	if (prefix) {
>  		struct object_id tree_oid;
> @@ -413,7 +413,7 @@ static void parse_treeish_arg(const char **argv,
>  		err = get_tree_entry(&tree->object.oid, prefix, &tree_oid,
>  				     &mode);
>  		if (err || !S_ISDIR(mode))
> -			die("current working directory is untracked");
> +			die(_("current working directory is untracked"));
>  
>  		tree = parse_tree_indirect(&tree_oid);
>  	}

Patch
diff mbox series

diff --git a/archive.c b/archive.c
index 9d16b7fadf..d8f6e1ce30 100644
--- a/archive.c
+++ b/archive.c
@@ -385,12 +385,12 @@  static void parse_treeish_arg(const char **argv,
 		int refnamelen = colon - name;
 
 		if (!dwim_ref(name, refnamelen, &oid, &ref))
-			die("no such ref: %.*s", refnamelen, name);
+			die(_("no such ref: %.*s"), refnamelen, name);
 		free(ref);
 	}
 
 	if (get_oid(name, &oid))
-		die("Not a valid object name");
+		die(_("not a valid object name: %s"), name);
 
 	commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
 	if (commit) {
@@ -403,7 +403,7 @@  static void parse_treeish_arg(const char **argv,
 
 	tree = parse_tree_indirect(&oid);
 	if (tree == NULL)
-		die("not a tree object");
+		die(_("not a tree object: %s"), oid_to_hex(&oid));
 
 	if (prefix) {
 		struct object_id tree_oid;
@@ -413,7 +413,7 @@  static void parse_treeish_arg(const char **argv,
 		err = get_tree_entry(&tree->object.oid, prefix, &tree_oid,
 				     &mode);
 		if (err || !S_ISDIR(mode))
-			die("current working directory is untracked");
+			die(_("current working directory is untracked"));
 
 		tree = parse_tree_indirect(&tree_oid);
 	}