]> git.ipfire.org Git - thirdparty/git.git/commitdiff
describe: localize debug output fully
authorMichael J Gruber <git@grubix.eu>
Mon, 27 Mar 2017 16:50:05 +0000 (18:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Mar 2017 20:45:23 +0000 (13:45 -0700)
git describe --debug localizes all debug messages but not the terms
head, lightweight, annotated that it outputs for the candidates.
Localize them, too.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/describe.c

index 45adbf67d5a065b0f55eeab6524563a0a7951c6c..a5cd8c513f96baaaa0d9a310e2bf02b8db41199b 100644 (file)
@@ -50,7 +50,7 @@ struct commit_name {
 };
 
 static const char *prio_names[] = {
-       "head", "lightweight", "annotated",
+       N_("head"), N_("lightweight"), N_("annotated"),
 };
 
 static int commit_name_cmp(const struct commit_name *cn1,
@@ -395,10 +395,19 @@ static void describe(const char *arg, int last_one)
        free_commit_list(list);
 
        if (debug) {
+               static int label_width = -1;
+               if (label_width < 0) {
+                       int i, w;
+                       for (i = 0; i < ARRAY_SIZE(prio_names); i++) {
+                               w = strlen(_(prio_names[i]));
+                               if (label_width < w)
+                                       label_width = w;
+                       }
+               }
                for (cur_match = 0; cur_match < match_cnt; cur_match++) {
                        struct possible_tag *t = &all_matches[cur_match];
-                       fprintf(stderr, " %-11s %8d %s\n",
-                               prio_names[t->name->prio],
+                       fprintf(stderr, " %-*s %8d %s\n",
+                               label_width, _(prio_names[t->name->prio]),
                                t->depth, t->name->path);
                }
                fprintf(stderr, _("traversed %lu commits\n"), seen_commits);