Miriam Rubio <mirucam@xxxxxxxxx> writes: > From: Pranit Bauva <pranit.bauva@xxxxxxxxx> > > Reimplement the `bisect_next()` and the `bisect_auto_next()` shell functions > in C and add the subcommands to `git bisect--helper` to call them from > git-bisect.sh . > > bisect_auto_next() function returns an enum bisect_error type as whole > `git bisect` can exit with an error code when bisect_next() does. > > Using `--bisect-next` and `--bisect-auto-next` subcommands is a > temporary measure to port shell function to C so as to use the existing > test suite. As more functions are ported, `--bisect-auto-next` > subcommand will be retired and will be called by some other methods. > ... > +static enum bisect_error bisect_next(struct bisect_terms *terms, const char *prefix) > +{ > + int no_checkout; > + enum bisect_error res; > + > + bisect_autostart(terms); > + if (bisect_next_check(terms, terms->term_good)) > + return BISECT_FAILED; > + > + no_checkout = file_exists(git_path_bisect_head()); The ref API is getting updated so that the 40-hex files whose names are all capital and ends with _HEAD are being converted from "files that happen to record 40-hex" to "refs that live at the toplevel outside refs/ hierarchy". Checking with no_checkout = ref_exists("BISECT_HEAD"); would work in both old and new worlds, hopefully. Similarly, if the new code you are writing reads directly from git_path_bisect_head(), write into it, or unlink it, these accesses should be replaced with calls to refs API (e.g. you already do so in your bisect_state() helper where you use get_oid() on the refname, not read from the file). Please learn to pay attention to your surroundings, or you risk colliding into other topics in flight. Thanks.