git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Pedro Larroy <pedro.larroy.lists@gmail.com>,
	Junio C Hamano <gitster@pobox.com>, git <git@vger.kernel.org>
Subject: Re: git bisect should return 1 when the first bad commit is found
Date: Mon, 24 Jun 2019 09:16:13 +0200	[thread overview]
Message-ID: <CAP8UFD1gWnkJZSzjOxOHdS4R3GCUSDgC9X85y_Yvc0LmyK19Cw@mail.gmail.com> (raw)
In-Reply-To: <20190623224935.GD1100@sigill.intra.peff.net>

On Mon, Jun 24, 2019 at 4:51 AM Jeff King <peff@peff.net> 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.

  reply	other threads:[~2019-06-24  7:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 22:33 git bisect should return 1 when the first bad commit is found Pedro Larroy
2019-06-13 18:22 ` Junio C Hamano
2019-06-23 20:32   ` Pedro Larroy
2019-06-23 22:49     ` Jeff King
2019-06-24  7:16       ` Christian Couder [this message]
2019-06-25  4:58         ` Jeff King
2019-06-24 18:41       ` Junio C Hamano
2019-06-25  4:53         ` Jeff King
2019-06-25  5:13           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP8UFD1gWnkJZSzjOxOHdS4R3GCUSDgC9X85y_Yvc0LmyK19Cw@mail.gmail.com \
    --to=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pedro.larroy.lists@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).