Skip to content

Commit 2cfa835

Browse files
fshpgitster
authored andcommitted
bisect_next_all: convert xsnprintf to xstrfmt
Git can't run bisect between 2048+ commits if use russian translation, because the translated string is too long for the fixed buffer it uses (this can be reproduced "LANG=ru_RU.UTF8 git bisect start v4.9 v4.8" on linux sources). Use xstrfmt() to format the message string to sufficiently sized buffer instead to fix this. Signed-off-by: Maxim Moseychuk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fbd0943 commit 2cfa835

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bisect.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
940940
struct commit_list *tried;
941941
int reaches = 0, all = 0, nr, steps;
942942
const unsigned char *bisect_rev;
943-
char steps_msg[32];
943+
char *steps_msg;
944944

945945
read_bisect_terms(&term_bad, &term_good);
946946
if (read_bisect_refs())
@@ -990,14 +990,15 @@ int bisect_next_all(const char *prefix, int no_checkout)
990990

991991
nr = all - reaches - 1;
992992
steps = estimate_bisect_steps(all);
993-
xsnprintf(steps_msg, sizeof(steps_msg),
994-
Q_("(roughly %d step)", "(roughly %d steps)", steps),
995-
steps);
993+
994+
steps_msg = xstrfmt(Q_("(roughly %d step)", "(roughly %d steps)",
995+
steps), steps);
996996
/* TRANSLATORS: the last %s will be replaced with
997997
"(roughly %d steps)" translation */
998998
printf(Q_("Bisecting: %d revision left to test after this %s\n",
999999
"Bisecting: %d revisions left to test after this %s\n",
10001000
nr), nr, steps_msg);
1001+
free(steps_msg);
10011002

10021003
return bisect_checkout(bisect_rev, no_checkout);
10031004
}

0 commit comments

Comments
 (0)