int show_root;
int xdl_opts;
int no_whole_file_rename;
+ int debug;
+
+ /* callbacks */
+ void(*on_sanity_fail)(struct blame_scoreboard *, int);
};
static void sanity_check_refcnt(struct blame_scoreboard *);
}
}
- if (DEBUG) /* sanity */
+ if (sb->debug) /* sanity */
sanity_check_refcnt(sb);
}
}
blame_origin_decref(suspect);
- if (DEBUG) /* sanity */
+ if (sb->debug) /* sanity */
sanity_check_refcnt(sb);
}
baa = 1;
}
}
- if (baa) {
- int opt = 0160;
- find_alignment(sb, &opt);
- output(sb, opt);
- die("Baa %d!", baa);
- }
+ if (baa)
+ sb->on_sanity_fail(sb, baa);
+}
+
+static void sanity_check_on_fail(struct blame_scoreboard *sb, int baa)
+{
+ int opt = OUTPUT_SHOW_SCORE | OUTPUT_SHOW_NUMBER | OUTPUT_SHOW_NAME;
+ find_alignment(sb, &opt);
+ output(sb, opt);
+ die("Baa %d!", baa);
}
static unsigned parse_score(const char *arg)
if (blame_copy_score)
sb.copy_score = blame_copy_score;
+ sb.debug = DEBUG;
+ sb.on_sanity_fail = &sanity_check_on_fail;
+
sb.show_root = show_root;
sb.xdl_opts = xdl_opts;
sb.no_whole_file_rename = no_whole_file_rename;