On Mon, Jun 24, 2019 at 4:51 AM Jeff King <peff@xxxxxxxx> wrote: > > On Sun, Jun 23, 2019 at 01:32:16PM -0700, Pedro Larroy wrote: > > > Thanks for your answer. > > > > I was expecting the HEAD to point to the first bad commit. > > > > In mercurial, the exit status tells you information about the > > bisection process: https://www.mercurial-scm.org/repo/hg/help/bisect It's not clear from he above URL how that differs from what git bisect does. I only found "Returns 0 on success" there which is not very explicit, and we could argue that it's also what git bisect does. > > Sure one can parse stdout, it's just more tedious than just checking > > the return code and having the HEAD left to the original bad commit. The git bisect documentation says: Eventually there will be no more revisions left to inspect, and the command will print out a description of the first bad commit. The reference refs/bisect/bad will be left pointing at that commit. So you just need to parse stdout to detect that it found the first bad commit, and then you can use refs/bisect/bad. If the return code was used, how would you distinguish between a failure in the command (for example if you give bad information to `git bisect good` or `git bisect bad`) and the fact that it has not yet found the first bad commit? Anyway you would need to add some logic for that. > I think it might be nice for Git to write a well-known refname (like > BISECT_RESULT or similar) so that you can refer to that instead of > having to read stdout (whether by machine or by a user > cutting-and-pasting). And I cannot offhand think of a particular reason > why that could not just be HEAD (instead of something bisect-specific) > after the bisect finishes. If it would be HEAD, it would mean that git bisect would potentially have to do one more checkout so that HEAD points to the first bad commit. This checkout would sometimes be useless, so it's more efficient to use something like refs/bisect/bad rather than HEAD. > We do not promise any particular value in HEAD now. The only downside > would be the minor cost to checkout the working tree of the known-bad > commit if we are not already there. Though we might not explicitly promise in the doc that HEAD will stay at the last commit that was tested, I think that's something people can expect from the way we describe how bisect work. So I don't think it would be a good idea to change our behavior.