git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Trevor Saunders <tbsaunde@tbsaunde.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] bisect: improve output when bad commit is found
Date: Mon, 11 May 2015 19:08:46 -0700	[thread overview]
Message-ID: <xmqqbnhq1r9t.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150511231125.GC18112@tsaunders-iceball.corp.tor1.mozilla.com> (Trevor Saunders's message of "Mon, 11 May 2015 19:11:25 -0400")

Trevor Saunders <tbsaunde@tbsaunde.org> writes:

>> > +	file=$1
>> > +	hash=$2
>> > +	grep "the first bad commit is" $file || return $?
>> > +	grep $hash $file || return $?
>> 
>> Is it OK to have these strings anywhere in the $file?
>
> Its not great, but the test seems to log multiple invokations of git
> bisect into the same file, so there may be text about previous runs
> before we are told which commit is bad.

So if we had a previous entry that happens to match $hash, even if
the current test stopped and pointed at a different thing, this test
declares a success?

This function knows how the $file should end, so it might be more
sensible to craft the expected output and compare the tail end of
the $file with it, something like:

	(
		echo "The first bad commit is"
                git show -s "$hash"
	) >expect &&
        cnt=$(wc -l <expect) &&
        tail -n $cnt "$file" >actual &&
        test_cmp expect actual

perhaps?

  reply	other threads:[~2015-05-12  2:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 20:58 [PATCH] bisect: improve output when bad commit is found Trevor Saunders
2015-05-11 21:12 ` Junio C Hamano
2015-05-11 23:11   ` Trevor Saunders
2015-05-12  2:08     ` Junio C Hamano [this message]
2015-05-12  2:10       ` Trevor Saunders

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=xmqqbnhq1r9t.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=tbsaunde@tbsaunde.org \
    /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 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 NNTP newsgroup(s).