]> git.ipfire.org Git - thirdparty/git.git/blobdiff - bisect.c
Makefile: improve SPARSE_FLAGS customisation
[thirdparty/git.git] / bisect.c
index e1275ba79e8e7368f5448043e321db2b9376aa71..487675c67249a3164294aae71c1c2a650f3c4947 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -13,6 +13,8 @@
 #include "sha1-array.h"
 #include "argv-array.h"
 #include "commit-slab.h"
+#include "commit-reach.h"
+#include "object-store.h"
 
 static struct oid_array good_revs;
 static struct oid_array skipped_revs;
@@ -120,14 +122,14 @@ static inline int halfway(struct commit_list *p, int nr)
        }
 }
 
-#if !DEBUG_BISECT
-#define show_list(a,b,c,d) do { ; } while (0)
-#else
 static void show_list(const char *debug, int counted, int nr,
                      struct commit_list *list)
 {
        struct commit_list *p;
 
+       if (!DEBUG_BISECT)
+               return;
+
        fprintf(stderr, "%s (%d/%d)\n", debug, counted, nr);
 
        for (p = list; p; p = p->next) {
@@ -145,7 +147,7 @@ static void show_list(const char *debug, int counted, int nr,
                        (flags & TREESAME) ? ' ' : 'T',
                        (flags & UNINTERESTING) ? 'U' : ' ',
                        (flags & COUNTED) ? 'C' : ' ');
-               if (commit->util)
+               if (*commit_weight_at(&commit_weight, p->item))
                        fprintf(stderr, "%3d", weight(p));
                else
                        fprintf(stderr, "---");
@@ -160,7 +162,6 @@ static void show_list(const char *debug, int counted, int nr,
                fprintf(stderr, "\n");
        }
 }
-#endif /* DEBUG_BISECT */
 
 static struct commit_list *best_bisection(struct commit_list *list, int nr)
 {
@@ -595,7 +596,7 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
 
        for (i = 0; cur; cur = cur->next, i++) {
                if (i == index) {
-                       if (oidcmp(&cur->item->object.oid, current_bad_oid))
+                       if (!oideq(&cur->item->object.oid, current_bad_oid))
                                return cur;
                        if (previous)
                                return previous;
@@ -632,7 +633,7 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
        struct argv_array rev_argv = ARGV_ARRAY_INIT;
        int i;
 
-       init_revisions(revs, prefix);
+       repo_init_revisions(the_repository, revs, prefix);
        revs->abbrev = 0;
        revs->commit_format = CMIT_FMT_UNSPECIFIED;
 
@@ -807,7 +808,7 @@ static void check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
 
        for (; result; result = result->next) {
                const struct object_id *mb = &result->item->object.oid;
-               if (!oidcmp(mb, current_bad_oid)) {
+               if (oideq(mb, current_bad_oid)) {
                        handle_bad_merge_base();
                } else if (0 <= oid_array_lookup(&good_revs, mb)) {
                        continue;
@@ -889,7 +890,7 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
        struct rev_info opt;
 
        /* diff-tree init */
-       init_revisions(&opt, prefix);
+       repo_init_revisions(the_repository, &opt, prefix);
        git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        opt.abbrev = 0;
        opt.diff = 1;
@@ -988,7 +989,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
        bisect_rev = &revs.commits->item->object.oid;
 
-       if (!oidcmp(bisect_rev, current_bad_oid)) {
+       if (oideq(bisect_rev, current_bad_oid)) {
                exit_if_skipped_commits(tried, current_bad_oid);
                printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
                        term_bad);