describe: localize debug output fully
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>
Michael J Gruber committed
Mar 27, 2017 at 18:50 UTC
646c3bd1ad59ab4aea2718d89c8eb9ce8cfa83bf
1 file changed
+12
-3
builtin/describe.c
+12
-3
@@ -50,7 +50,7 @@ struct commit_name {
50
};
51
52
static const char *prio_names[] = {
53
- "head", "lightweight", "annotated",
53
+ N_("head"), N_("lightweight"), N_("annotated"),
54
};
55
56
static int commit_name_cmp(const struct commit_name *cn1,
@@ -395,10 +395,19 @@ static void describe(const char *arg, int last_one)
395
free_commit_list(list);
396
397
if (debug) {
398
+ static int label_width = -1;
399
+ if (label_width < 0) {
400
+ int i, w;
401
+ for (i = 0; i < ARRAY_SIZE(prio_names); i++) {
402
+ w = strlen(_(prio_names[i]));
403
+ if (label_width < w)
404
+ label_width = w;
405
+ }
406
+ }
407
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
408
struct possible_tag *t = &all_matches[cur_match];
400
- fprintf(stderr, " %-11s %8d %s\n",
401
- prio_names[t->name->prio],
409
+ fprintf(stderr, " %-*s %8d %s\n",
410
+ label_width, _(prio_names[t->name->prio]),
411
t->depth, t->name->path);
412
}
413
fprintf(stderr, _("traversed %lu commits\n"), seen_commits);