summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2009-05-09 17:55:38 +0200
committerJunio C Hamano <gitster@pobox.com>2009-05-10 14:30:16 -0700
commit6212b1aae9dcc0de1dca1553298c6668579dd184 (patch)
treed03e79f99c44b9a5451ea364f363bed911701aec
parent47c9739e5e02484de618ca70a592ecd25c05fd1a (diff)
downloadgit-6212b1aae9dcc0de1dca1553298c6668579dd184.tar.gz
bisect: use "sha1_array" to store skipped revisions
This patch creates a "struct sha1_array" to store skipped revisions, so that the same struct can be reused in a later patch for good revisions. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--bisect.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/bisect.c b/bisect.c
index 4796aa9198..12df855cfa 100644
--- a/bisect.c
+++ b/bisect.c
@@ -9,9 +9,13 @@
#include "run-command.h"
#include "bisect.h"
-static unsigned char (*skipped_sha1)[20];
-static int skipped_sha1_nr;
-static int skipped_sha1_alloc;
+struct sha1_array {
+ unsigned char (*sha1)[20];
+ int sha1_nr;
+ int sha1_alloc;
+};
+
+static struct sha1_array skipped_revs;
static const char **rev_argv;
static int rev_argv_nr;
@@ -420,9 +424,9 @@ static int register_ref(const char *refname, const unsigned char *sha1,
ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
rev_argv[rev_argv_nr++] = good;
} else if (!prefixcmp(refname, "skip-")) {
- ALLOC_GROW(skipped_sha1, skipped_sha1_nr + 1,
- skipped_sha1_alloc);
- hashcpy(skipped_sha1[skipped_sha1_nr++], sha1);
+ ALLOC_GROW(skipped_revs.sha1, skipped_revs.sha1_nr + 1,
+ skipped_revs.sha1_alloc);
+ hashcpy(skipped_revs.sha1[skipped_revs.sha1_nr++], sha1);
}
return 0;
@@ -466,7 +470,8 @@ static int skipcmp(const void *a, const void *b)
static void prepare_skipped(void)
{
- qsort(skipped_sha1, skipped_sha1_nr, sizeof(*skipped_sha1), skipcmp);
+ qsort(skipped_revs.sha1, skipped_revs.sha1_nr,
+ sizeof(*skipped_revs.sha1), skipcmp);
}
static const unsigned char *skipped_sha1_access(size_t index, void *table)
@@ -477,7 +482,7 @@ static const unsigned char *skipped_sha1_access(size_t index, void *table)
static int lookup_skipped(unsigned char *sha1)
{
- return sha1_pos(sha1, skipped_sha1, skipped_sha1_nr,
+ return sha1_pos(sha1, skipped_revs.sha1, skipped_revs.sha1_nr,
skipped_sha1_access);
}
@@ -489,7 +494,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
*tried = NULL;
- if (!skipped_sha1_nr)
+ if (!skipped_revs.sha1_nr)
return list;
prepare_skipped();
@@ -551,7 +556,7 @@ static void bisect_common(struct rev_info *revs, const char *prefix,
mark_edges_uninteresting(revs->commits, revs, NULL);
revs->commits = find_bisection(revs->commits, reaches, all,
- !!skipped_sha1_nr);
+ !!skipped_revs.sha1_nr);
}
static void exit_if_skipped_commits(struct commit_list *tried,