#include "bisect.h"
#include "sha1-array.h"
#include "argv-array.h"
+#include "commit-slab.h"
static struct oid_array good_revs;
static struct oid_array skipped_revs;
}
}
+define_commit_slab(commit_weight, int *);
+static struct commit_weight commit_weight;
+
#define DEBUG_BISECT 0
static inline int weight(struct commit_list *elem)
{
- return *((int*)(elem->item->util));
+ return **commit_weight_at(&commit_weight, elem->item);
}
static inline void weight_set(struct commit_list *elem, int weight)
{
- *((int*)(elem->item->util)) = weight;
+ **commit_weight_at(&commit_weight, elem->item) = weight;
}
static int count_interesting_parents(struct commit *commit)
unsigned flags = commit->object.flags;
enum object_type type;
unsigned long size;
- char *buf = read_sha1_file(commit->object.oid.hash, &type, &size);
+ char *buf = read_object_file(&commit->object.oid, &type,
+ &size);
const char *subject_start;
int subject_len;
fprintf(stderr, "%3d", weight(p));
else
fprintf(stderr, "---");
- fprintf(stderr, " %.*s", 8, sha1_to_hex(commit->object.oid.hash));
+ fprintf(stderr, " %.*s", 8, oid_to_hex(&commit->object.oid));
for (pp = commit->parents; pp; pp = pp->next)
fprintf(stderr, " %.*s", 8,
- sha1_to_hex(pp->item->object.oid.hash));
+ oid_to_hex(&pp->item->object.oid));
subject_len = find_commit_subject(buf, &subject_start);
if (subject_len)
struct commit *commit = p->item;
unsigned flags = commit->object.flags;
- p->item->util = &weights[n++];
+ *commit_weight_at(&commit_weight, p->item) = &weights[n++];
switch (count_interesting_parents(commit)) {
case 0:
if (!(flags & TREESAME)) {
int *weights;
show_list("bisection 2 entry", 0, 0, *commit_list);
+ init_commit_weight(&commit_weight);
/*
* Count the number of total and tree-changing items on the
}
free(weights);
*commit_list = best;
+ clear_commit_weight(&commit_weight);
}
static int register_ref(const char *refname, const struct object_id *oid,