char *sha1_to_hex(const unsigned char *sha1) { static int bufno; static char hexbuffer[4][GIT_SHA1_HEXSZ + 1]; bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer); return sha1_to_hex_r(hexbuffer[bufno], sha1); }
static int show_bisect_vars(struct rev_list_info *info, int reaches, int all) { int cnt, flags = info->flags; char hex[GIT_SHA1_HEXSZ + 1] = ""; struct commit_list *tried; struct rev_info *revs = info->revs; if (!revs->commits) return 1; revs->commits = filter_skipped(revs->commits, &tried, flags & BISECT_SHOW_ALL, NULL, NULL); /* * revs->commits can reach "reaches" commits among * "all" commits. If it is good, then there are * (all-reaches) commits left to be bisected. * On the other hand, if it is bad, then the set * to bisect is "reaches". * A bisect set of size N has (N-1) commits further * to test, as we already know one bad one. */ cnt = all - reaches; if (cnt < reaches) cnt = reaches; if (revs->commits) sha1_to_hex_r(hex, revs->commits->item->object.oid.hash); if (flags & BISECT_SHOW_ALL) { traverse_commit_list(revs, show_commit, show_object, info); printf("------\n"); } print_var_str("bisect_rev", hex); print_var_int("bisect_nr", cnt - 1); print_var_int("bisect_good", all - reaches - 1); print_var_int("bisect_bad", reaches - 1); print_var_int("bisect_all", all); print_var_int("bisect_steps", estimate_bisect_steps(all)); return 0; }
char *sha1_to_hex(const unsigned char *sha1) { static int bufno; static char hexbuffer[4][GIT_SHA1_HEXSZ + 1]; return sha1_to_hex_r(hexbuffer[3 & ++bufno], sha1); }
char *oid_to_hex_r(char *buffer, const struct object_id *oid) { return sha1_to_hex_r(buffer, oid->hash); }