Skip to content

Commit 646c3bd

Browse files
mjggitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e0ef7fe commit 646c3bd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

builtin/describe.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct commit_name {
5050
};
5151

5252
static const char *prio_names[] = {
53-
"head", "lightweight", "annotated",
53+
N_("head"), N_("lightweight"), N_("annotated"),
5454
};
5555

5656
static int commit_name_cmp(const struct commit_name *cn1,
@@ -395,10 +395,19 @@ static void describe(const char *arg, int last_one)
395395
free_commit_list(list);
396396

397397
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+
}
398407
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
399408
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]),
402411
t->depth, t->name->path);
403412
}
404413
fprintf(stderr, _("traversed %lu commits\n"), seen_commits);

0 commit comments

Comments
 (0)