@ -648,11 +648,14 @@ static struct commit_list *managed_skipped(struct commit_list *list,
@@ -648,11 +648,14 @@ static struct commit_list *managed_skipped(struct commit_list *list,
}
static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
struct strvec *rev_argv,
const char *prefix,
const char *bad_format, const char *good_format,
int read_paths)
{
struct strvec rev_argv = STRVEC_INIT;
struct setup_revision_opt opt = {
.free_removed_argv_elements = 1,
};
int i;
repo_init_revisions(r, revs, prefix);
@ -660,17 +663,16 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
@@ -660,17 +663,16 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
revs->commit_format = CMIT_FMT_UNSPECIFIED;
/* rev_argv.argv[0] will be ignored by setup_revisions */
strvec_push(&rev_argv, "bisect_rev_setup");
strvec_pushf(&rev_argv, bad_format, oid_to_hex(current_bad_oid));
strvec_push(rev_argv, "bisect_rev_setup");
strvec_pushf(rev_argv, bad_format, oid_to_hex(current_bad_oid));
for (i = 0; i < good_revs.nr; i++)
strvec_pushf(&rev_argv, good_format,
strvec_pushf(rev_argv, good_format,
oid_to_hex(good_revs.oid + i));
strvec_push(&rev_argv, "--");
strvec_push(rev_argv, "--");
if (read_paths)
read_bisect_paths(&rev_argv);
read_bisect_paths(rev_argv);
setup_revisions(rev_argv.nr, rev_argv.v, revs, NULL);
/* XXX leak rev_argv, as "revs" may still be pointing to it */
setup_revisions(rev_argv->nr, rev_argv->v, revs, &opt);
}
static void bisect_common(struct rev_info *revs)
@ -873,10 +875,11 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
@@ -873,10 +875,11 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
static int check_ancestors(struct repository *r, int rev_nr,
struct commit **rev, const char *prefix)
{
struct strvec rev_argv = STRVEC_INIT;
struct rev_info revs;
int res;
bisect_rev_setup(r, &revs, prefix, "^%s", "%s", 0);
bisect_rev_setup(r, &revs, &rev_argv, prefix, "^%s", "%s", 0);
bisect_common(&revs);
res = (revs.commits != NULL);
@ -885,6 +888,7 @@ static int check_ancestors(struct repository *r, int rev_nr,
@@ -885,6 +888,7 @@ static int check_ancestors(struct repository *r, int rev_nr,
clear_commit_marks_many(rev_nr, rev, ALL_REV_FLAGS);
release_revisions(&revs);
strvec_clear(&rev_argv);
return res;
}
@ -1010,6 +1014,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
@@ -1010,6 +1014,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
*/
enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
{
struct strvec rev_argv = STRVEC_INIT;
struct rev_info revs = REV_INFO_INIT;
struct commit_list *tried;
int reaches = 0, all = 0, nr, steps;
@ -1037,7 +1042,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
@@ -1037,7 +1042,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
if (res)
goto cleanup;
bisect_rev_setup(r, &revs, prefix, "%s", "^%s", 1);
bisect_rev_setup(r, &revs, &rev_argv, prefix, "%s", "^%s", 1);
revs.first_parent_only = !!(bisect_flags & FIND_BISECTION_FIRST_PARENT_ONLY);
revs.limited = 1;
@ -1054,7 +1059,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
@@ -1054,7 +1059,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
*/
res = error_if_skipped_commits(tried, NULL);
if (res < 0)
return res;
goto cleanup;
printf(_("%s was both %s and %s\n"),
oid_to_hex(current_bad_oid),
term_good,
@ -1112,6 +1117,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
@@ -1112,6 +1117,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
res = bisect_checkout(bisect_rev, no_checkout);
cleanup:
release_revisions(&revs);
strvec_clear(&rev_argv);
return res;
}