public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Michael Haggerty <mhagger@alum•mit.edu>,
	Anders Kaseorg <andersk@mit•edu>,
	Stefan Beller <sbeller@google•com>,
	git@vger•kernel.org
Subject: Re: [PATCH 1/3] t6301: new tests of for-each-ref error handling
Date: Mon, 01 Jun 2015 10:33:08 -0700	[thread overview]
Message-ID: <xmqqa8wj72qz.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150601160834.GA15148@peff.net> (Jeff King's message of "Mon, 1 Jun 2015 12:08:34 -0400")

Jeff King <peff@peff•net> writes:

> On Mon, Jun 01, 2015 at 05:53:49PM +0200, Michael Haggerty wrote:
>
>> Add tests that for-each-ref correctly reports broken loose reference
>> files and references that point at missing objects. In fact, two of
>> these tests fail, because (1) NULL_SHA1 is not recognized as an
>> invalid reference value, and (2) for-each-ref doesn't respect
>> REF_ISBROKEN. Fixes to come.
>
> This whole series looks straightforward and correct to me. Thanks for a
> pleasant read. I have two minor comments on the tests:
>
>> --- /dev/null
>> +++ b/t/t6301-for-each-ref-errors.sh
>> @@ -0,0 +1,45 @@
>> +#!/bin/sh
>> +
>> +test_description='for-each-ref errors for broken refs'
>> +
>> +. ./test-lib.sh
>> +
>> +ZEROS=0000000000000000000000000000000000000000
>> +MISSING=abababababababababababababababababababab
>
> The test suite provides $_z40, so you can skip $ZEROS. I don't think
> it's a big deal, though, and it may be nicer to have it explicitly next
> to $MISSING here.

Yeah, ZEROS=$_z40 next to MISSING=abababa... may not be too bad.

>> +test_expect_success 'Missing objects are reported correctly' '
>> +	r=refs/heads/missing &&
>> +	echo $MISSING >.git/$r &&
>> +	test_when_finished "rm -f .git/$r" &&
>> +	echo "fatal: missing object $MISSING for $r" >missing-err &&
>> +	test_must_fail git for-each-ref 2>err &&
>> +	test_cmp missing-err err
>> +'
>
> Due to b7dd2d2 (that you mentioned in the message for patch 2), we only
> sometimes notice the missing objects. Is it worth testing that:
>
>   git for-each-ref --format='%(refname)'
>
> does _not_ barf here?

Sound like a good thing to check, too.

Thanks.

  reply	other threads:[~2015-06-01 17:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 15:53 [PATCH 0/3] Fix how for-each-ref handles broken loose references Michael Haggerty
2015-06-01 15:53 ` [PATCH 1/3] t6301: new tests of for-each-ref error handling Michael Haggerty
2015-06-01 16:08   ` Jeff King
2015-06-01 17:33     ` Junio C Hamano [this message]
2015-06-02 15:46     ` Michael Haggerty
2015-06-01 15:53 ` [PATCH 2/3] for-each-ref: report broken references correctly Michael Haggerty
2015-06-01 15:53 ` [PATCH 3/3] read_loose_refs(): treat NULL_SHA1 loose references as broken Michael Haggerty

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=xmqqa8wj72qz.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=andersk@mit$(echo .)edu \
    --cc=git@vger$(echo .)kernel.org \
    --cc=mhagger@alum$(echo .)mit.edu \
    --cc=peff@peff$(echo .)net \
    --cc=sbeller@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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