All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christian Couder <christian.couder@gmail.com>,
	Pedro Larroy <pedro.larroy.lists@gmail.com>,
	git@vger.kernel.org
Subject: Re: git bisect should return 1 when the first bad commit is found
Date: Tue, 25 Jun 2019 00:53:04 -0400	[thread overview]
Message-ID: <20190625045304.GA7626@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqo92mhlla.fsf@gitster-ct.c.googlers.com>

On Mon, Jun 24, 2019 at 11:41:53AM -0700, Junio C Hamano wrote:

> > 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.
> 
> As Christian downthread reminds us, that is what the bisect/bad ref
> is (which I totally forgot when I gave the earlier response).  I do
> not think we need a new ref, but I do not think it is so bad to add
> an option "git bisect --exit-code ( --good | --bad ) [<commit-ish>]"
> that makes the command usually exit with non-zero status.  Unless we
> have found the final answer successfully, that is, and in that case
> the command would exit with 0 status to signall "all done".
> 
> But that should be an option.

Ah, right, I forgot that we already have such a ref. So that does seem
like a reasonable way to access it (and as Christian notes, it's
documented as well).  And I agree with you that any exit-code magic
should require the user to ask for it explicitly.

I do think that accessing the bisect/bad ref is a little intimate with
the implementation (i.e., it implies knowing that there is only a single
"bad" that we are moving around, unlike "good", where we may mark many
such tips).

So another option is to put the result in a new ref (bisect/result,
perhaps), but with one twist: delete it at the beginning of a bisection,
so its presence can be used as a marker that the bisection is complete.
I.e., you could do "git rev-parse --verify refs/bisect/result" as an
alternative to "--exit-code". That gives you the added flexibility of
asking "is the bisection done" separately from "do this next bisection
step".

-Peff

  reply	other threads:[~2019-06-25  4:53 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
2019-06-25  4:58         ` Jeff King
2019-06-24 18:41       ` Junio C Hamano
2019-06-25  4:53         ` Jeff King [this message]
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

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

  git send-email \
    --in-reply-to=20190625045304.GA7626@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pedro.larroy.lists@gmail.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.