summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3755ccd)
raw | patch | inline | side by side (parent: 3755ccd)
author | Christian Couder <chriscool@tuxfamily.org> | |
Sat, 9 May 2009 15:55:40 +0000 (17:55 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 May 2009 21:30:22 +0000 (14:30 -0700) |
This will make it easier to use good revisions for checking merge
bases later.
To simplify the code, a new "sha1_array_push" function is also
introduced.
And while at it we move the earlier part of the code to fill the
argv that is passed to "setup_revisions", so that all this code is
now completely after "read_bisect_refs".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bases later.
To simplify the code, a new "sha1_array_push" function is also
introduced.
And while at it we move the earlier part of the code to fill the
argv that is passed to "setup_revisions", so that all this code is
now completely after "read_bisect_refs".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c | patch | blob | history |
diff --git a/bisect.c b/bisect.c
index f99637d9cf0f0caf4f9c99fd34e36a2a11974588..7976cbfcd791e0ddd69e04d8f0e2902661b4ec74 100644 (file)
--- a/bisect.c
+++ b/bisect.c
int sha1_alloc;
};
+static struct sha1_array good_revs;
static struct sha1_array skipped_revs;
static const char **rev_argv;
rev_argv[rev_argv_nr++] = strbuf_detach(&buf, NULL);
}
+static void sha1_array_push(struct sha1_array *array,
+ const unsigned char *sha1)
+{
+ ALLOC_GROW(array->sha1, array->sha1_nr + 1, array->sha1_alloc);
+ hashcpy(array->sha1[array->sha1_nr++], sha1);
+}
+
static int register_ref(const char *refname, const unsigned char *sha1,
int flags, void *cb_data)
{
if (!strcmp(refname, "bad")) {
current_bad_sha1 = sha1;
- rev_argv_push(sha1, "%s");
} else if (!prefixcmp(refname, "good-")) {
- rev_argv_push(sha1, "^%s");
+ sha1_array_push(&good_revs, sha1);
} else if (!prefixcmp(refname, "skip-")) {
- ALLOC_GROW(skipped_revs.sha1, skipped_revs.sha1_nr + 1,
- skipped_revs.sha1_alloc);
- hashcpy(skipped_revs.sha1[skipped_revs.sha1_nr++], sha1);
+ sha1_array_push(&skipped_revs, sha1);
}
return 0;
static void bisect_rev_setup(struct rev_info *revs, const char *prefix)
{
+ int i;
+
init_revisions(revs, prefix);
revs->abbrev = 0;
revs->commit_format = CMIT_FMT_UNSPECIFIED;
+ if (read_bisect_refs())
+ die("reading bisect refs failed");
+
/* argv[0] will be ignored by setup_revisions */
ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
rev_argv[rev_argv_nr++] = xstrdup("bisect_rev_setup");
- if (read_bisect_refs())
- die("reading bisect refs failed");
+ rev_argv_push(current_bad_sha1, "%s");
+
+ for (i = 0; i < good_revs.sha1_nr; i++)
+ rev_argv_push(good_revs.sha1[i], "^%s");
ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
rev_argv[rev_argv_nr++] = xstrdup("--");