summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c75
1 files changed, 42 insertions, 33 deletions
diff --git a/bisect.c b/bisect.c
index 6d0793b..6f512c2 100644
--- a/bisect.c
+++ b/bisect.c
@@ -438,12 +438,12 @@ static void read_bisect_paths(struct argv_array *array)
FILE *fp = fopen(filename, "r");
if (!fp)
- die_errno("Could not open file '%s'", filename);
+ die_errno(_("Could not open file '%s'"), filename);
- while (strbuf_getline(&str, fp, '\n') != EOF) {
+ while (strbuf_getline_lf(&str, fp) != EOF) {
strbuf_trim(&str);
if (sq_dequote_to_argv_array(str.buf, array))
- die("Badly quoted content in file '%s': %s",
+ die(_("Badly quoted content in file '%s': %s"),
filename, str.buf);
}
@@ -646,10 +646,13 @@ static void exit_if_skipped_commits(struct commit_list *tried,
printf("There are only 'skip'ped commits left to test.\n"
"The first %s commit could be any of:\n", term_bad);
- print_commit_list(tried, "%s\n", "%s\n");
+
+ for ( ; tried; tried = tried->next)
+ printf("%s\n", oid_to_hex(&tried->item->object.oid));
+
if (bad)
printf("%s\n", oid_to_hex(bad));
- printf("We cannot bisect more!\n");
+ printf(_("We cannot bisect more!\n"));
exit(2);
}
@@ -668,7 +671,7 @@ static int is_expected_rev(const struct object_id *oid)
if (!fp)
return 0;
- if (strbuf_getline(&str, fp, '\n') != EOF)
+ if (strbuf_getline_lf(&str, fp) != EOF)
res = !strcmp(str.buf, oid_to_hex(oid));
strbuf_release(&str);
@@ -702,7 +705,7 @@ static struct commit *get_commit_reference(const unsigned char *sha1)
{
struct commit *r = lookup_commit_reference(sha1);
if (!r)
- die("Not a valid commit name %s", sha1_to_hex(sha1));
+ die(_("Not a valid commit name %s"), sha1_to_hex(sha1));
return r;
}
@@ -726,27 +729,27 @@ static void handle_bad_merge_base(void)
char *bad_hex = oid_to_hex(current_bad_oid);
char *good_hex = join_sha1_array_hex(&good_revs, ' ');
if (!strcmp(term_bad, "bad") && !strcmp(term_good, "good")) {
- fprintf(stderr, "The merge base %s is bad.\n"
+ fprintf(stderr, _("The merge base %s is bad.\n"
"This means the bug has been fixed "
- "between %s and [%s].\n",
+ "between %s and [%s].\n"),
bad_hex, bad_hex, good_hex);
} else if (!strcmp(term_bad, "new") && !strcmp(term_good, "old")) {
- fprintf(stderr, "The merge base %s is new.\n"
+ fprintf(stderr, _("The merge base %s is new.\n"
"The property has changed "
- "between %s and [%s].\n",
+ "between %s and [%s].\n"),
bad_hex, bad_hex, good_hex);
} else {
- fprintf(stderr, "The merge base %s is %s.\n"
+ fprintf(stderr, _("The merge base %s is %s.\n"
"This means the first '%s' commit is "
- "between %s and [%s].\n",
+ "between %s and [%s].\n"),
bad_hex, term_bad, term_good, bad_hex, good_hex);
}
exit(3);
}
- fprintf(stderr, "Some %s revs are not ancestor of the %s rev.\n"
+ fprintf(stderr, _("Some %s revs are not ancestor of the %s rev.\n"
"git bisect cannot work properly in this case.\n"
- "Maybe you mistook %s and %s revs?\n",
+ "Maybe you mistook %s and %s revs?\n"),
term_good, term_bad, term_good, term_bad);
exit(1);
}
@@ -754,14 +757,14 @@ static void handle_bad_merge_base(void)
static void handle_skipped_merge_base(const unsigned char *mb)
{
char *mb_hex = sha1_to_hex(mb);
- char *bad_hex = sha1_to_hex(current_bad_oid->hash);
+ char *bad_hex = oid_to_hex(current_bad_oid);
char *good_hex = join_sha1_array_hex(&good_revs, ' ');
- warning("the merge base between %s and [%s] "
+ warning(_("the merge base between %s and [%s] "
"must be skipped.\n"
"So we cannot be sure the first %s commit is "
"between %s and %s.\n"
- "We continue anyway.",
+ "We continue anyway."),
bad_hex, good_hex, term_bad, mb_hex, bad_hex);
free(good_hex);
}
@@ -792,7 +795,7 @@ static void check_merge_bases(int no_checkout)
} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {
handle_skipped_merge_base(mb);
} else {
- printf("Bisecting: a merge base must be tested\n");
+ printf(_("Bisecting: a merge base must be tested\n"));
exit(bisect_checkout(mb, no_checkout));
}
}
@@ -843,7 +846,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
int fd;
if (!current_bad_oid)
- die("a %s revision is needed", term_bad);
+ die(_("a %s revision is needed"), term_bad);
/* Check if file BISECT_ANCESTORS_OK exists. */
if (!stat(filename, &st) && S_ISREG(st.st_mode))
@@ -860,8 +863,8 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
/* Create file BISECT_ANCESTORS_OK. */
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (fd < 0)
- warning("could not create file '%s': %s",
- filename, strerror(errno));
+ warning_errno(_("could not create file '%s'"),
+ filename);
else
close(fd);
done:
@@ -890,6 +893,7 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
if (!opt.diffopt.output_format)
opt.diffopt.output_format = DIFF_FORMAT_RAW;
+ setup_revisions(0, NULL, &opt, NULL);
log_tree_commit(&opt, commit);
}
@@ -910,13 +914,12 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
*read_good = "good";
return;
} else {
- die("could not read file '%s': %s", filename,
- strerror(errno));
+ die_errno(_("could not read file '%s'"), filename);
}
} else {
- strbuf_getline(&str, fp, '\n');
+ strbuf_getline_lf(&str, fp);
*read_bad = strbuf_detach(&str, NULL);
- strbuf_getline(&str, fp, '\n');
+ strbuf_getline_lf(&str, fp);
*read_good = strbuf_detach(&str, NULL);
}
strbuf_release(&str);
@@ -937,10 +940,11 @@ int bisect_next_all(const char *prefix, int no_checkout)
struct commit_list *tried;
int reaches = 0, all = 0, nr, steps;
const unsigned char *bisect_rev;
+ char steps_msg[32];
read_bisect_terms(&term_bad, &term_good);
if (read_bisect_refs())
- die("reading bisect refs failed");
+ die(_("reading bisect refs failed"));
check_good_are_ancestors_of_bad(prefix, no_checkout);
@@ -960,7 +964,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
*/
exit_if_skipped_commits(tried, NULL);
- printf("%s was both %s and %s\n",
+ printf(_("%s was both %s and %s\n"),
oid_to_hex(current_bad_oid),
term_good,
term_bad);
@@ -968,8 +972,8 @@ int bisect_next_all(const char *prefix, int no_checkout)
}
if (!all) {
- fprintf(stderr, "No testable commit found.\n"
- "Maybe you started with bad path parameters?\n");
+ fprintf(stderr, _("No testable commit found.\n"
+ "Maybe you started with bad path parameters?\n"));
exit(4);
}
@@ -986,9 +990,14 @@ int bisect_next_all(const char *prefix, int no_checkout)
nr = all - reaches - 1;
steps = estimate_bisect_steps(all);
- printf("Bisecting: %d revision%s left to test after this "
- "(roughly %d step%s)\n", nr, (nr == 1 ? "" : "s"),
- steps, (steps == 1 ? "" : "s"));
+ xsnprintf(steps_msg, sizeof(steps_msg),
+ Q_("(roughly %d step)", "(roughly %d steps)", steps),
+ steps);
+ /* TRANSLATORS: the last %s will be replaced with
+ "(roughly %d steps)" translation */
+ printf(Q_("Bisecting: %d revision left to test after this %s\n",
+ "Bisecting: %d revisions left to test after this %s\n",
+ nr), nr, steps_msg);
return bisect_checkout(bisect_rev, no_checkout);
}