git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] t6301: new tests of for-each-ref error handling

From
Jeff King <peff@peff.net>
Date
Jun 1, 2015, 16:08 UTC
Message-ID
<20150601160834.GA15148@peff.net>
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:
Show 5 quoted lines
> 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:

Show 11 quoted lines
> --- /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.

Show 8 quoted lines
> +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
Previous: Michael HaggertyNext: Junio C Hamano
Message 3 of 7 in “Fix how for-each-ref handles broken loose references”
  1. 0/3 Fix how for-each-ref handles broken loose referencesMichael Haggerty, Jun 1, 2015
  2. 1/3 t6301: new tests of for-each-ref error handlingMichael Haggerty, Jun 1, 2015
  3. Jeff KingJun 1, 2015
  4. Junio C HamanoJun 1, 2015
  5. Michael HaggertyJun 2, 2015
  6. 2/3 for-each-ref: report broken references correctlyMichael Haggerty, Jun 1, 2015
  7. 3/3 read_loose_refs(): treat NULL_SHA1 loose references as brokenMichael Haggerty, Jun 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.