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 <franchesko.salias.hudro.pedros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Maxim Moseychuk committed
Feb 16, 2017 at 20:07 UTC
2cfa83574c4b2685208a1e6062fdc573c887cf00
1 file changed
+5
-4
bisect.c
+5
-4
@@ -940,7 +940,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
940
struct commit_list *tried;
941
int reaches = 0, all = 0, nr, steps;
942
const unsigned char *bisect_rev;
943
- char steps_msg[32];
943
+ char *steps_msg;
944
945
read_bisect_terms(&term_bad, &term_good);
946
if (read_bisect_refs())
@@ -990,14 +990,15 @@ int bisect_next_all(const char *prefix, int no_checkout)
990
991
nr = all - reaches - 1;
992
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);
996
/* TRANSLATORS: the last %s will be replaced with
997
"(roughly %d steps)" translation */
998
printf(Q_("Bisecting: %d revision left to test after this %s\n",
999
"Bisecting: %d revisions left to test after this %s\n",
1000
nr), nr, steps_msg);
1001
+ free(steps_msg);
1002
1003
return bisect_checkout(bisect_rev, no_checkout);
1004
}