git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Junio C Hamano <gitster@pobox.com>,
	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, 1 Jun 2015 12:08:34 -0400	[thread overview]
Message-ID: <20150601160834.GA15148@peff.net> (raw)
In-Reply-To: <1433174031-5471-2-git-send-email-mhagger@alum.mit.edu>

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.

> +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?

-Peff

  reply	other threads:[~2015-06-01 16:08 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 [this message]
2015-06-01 17:33     ` Junio C Hamano
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=20150601160834.GA15148@peff.net \
    --to=peff@peff.net \
    --cc=andersk@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=sbeller@google.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 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).