path: root/bisect.c
diff options
authorNguyễn Thái Ngọc Duy <>2018-09-02 07:42:50 (GMT)
committerJunio C Hamano <>2018-09-04 16:54:05 (GMT)
commitb0eb92bbc297348a47cc25bdd9d32ab338289359 (patch)
treec3a2e5b83b3d95a708cf25cd21750661b19a26de /bisect.c
parent2f743933341f276111103550fbf383a34dfcfd38 (diff)
bisect.c: make show_list() build again
This function only compiles when DEBUG_BISECT is 1, which is often not the case. As a result there are two commits [1] [2] that break it but the breakages went unnoticed because the code did not compile by default. Update the function and include the new header file to make this function build again. In order to stop this from happening again, the function is now compiled unconditionally but exits early unless DEBUG_BISECT is non-zero. A smart compiler generates no extra code (not even a function call). But even if it does not, this function does not seem to be in a hot path that the extra cost becomes a big problem. [1] bb408ac95d (bisect.c: use commit-slab for commit weight instead of commit->util - 2018-05-19) [2] cbd53a2193 (object-store: move object access functions to object-store.h - 2018-05-15) Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'bisect.c')
1 files changed, 5 insertions, 5 deletions
diff --git a/bisect.c b/bisect.c
index e1275ba..e65f682 100644
--- a/bisect.c
+++ b/bisect.c
@@ -13,6 +13,7 @@
#include "sha1-array.h"
#include "argv-array.h"
#include "commit-slab.h"
+#include "object-store.h"
static struct oid_array good_revs;
static struct oid_array skipped_revs;
@@ -120,14 +121,14 @@ static inline int halfway(struct commit_list *p, int nr)
-#define show_list(a,b,c,d) do { ; } while (0)
static void show_list(const char *debug, int counted, int nr,
struct commit_list *list)
struct commit_list *p;
+ return;
fprintf(stderr, "%s (%d/%d)\n", debug, counted, nr);
for (p = list; p; p = p->next) {
@@ -145,7 +146,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));
fprintf(stderr, "---");
@@ -160,7 +161,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)