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

Re: [PATCH v3 2/3] fsck: handle bad trees like other errors

From
Jeff King <peff@peff.net>
Date
Sep 27, 2016, 19:03 UTC
Message-ID
<20160927190326.6wdmxodfisdiku2c@sigill.intra.peff.net>
In-Reply-To
<1474989806-5002-2-git-send-email-dturner@twosigma.com>
On Tue, Sep 27, 2016 at 11:23:25AM -0400, David Turner wrote:
Show 12 quoted lines
> +test_expect_success 'unparseable tree object' '
> +	test_when_finished "git update-ref -d refs/heads/wrong" &&
> +	test_when_finished "remove_object \$tree_sha1" &&
> +	test_when_finished "remove_object \$commit_sha1" &&
> +	tree_sha1=$(printf "100644 \0twenty-bytes-of-junk" | git hash-object -t tree --stdin -w --literally) &&
> +	commit_sha1=$(git commit-tree $tree_sha1) &&
> +	git update-ref refs/heads/wrong $commit_sha1 &&
> +	test_must_fail git fsck 2>out &&
> +	test_i18ngrep "error: empty filename in tree entry" out &&
> +	test_i18ngrep "$tree_sha1" out &&
> +	! test_i18ngrep "fatal: empty filename in tree entry" out
> +'
Unfortunately this last one needs to be spelled as:
  test_i18ngrep ! "fatal: empty filename in tree entry" out

because the function always pretends to match when GETTEXT_POISON is set.

Other than the minor test fixups, this all looks good to me.
-Peff
Previous: David TurnerNext: David Turner
Message 3 of 7 in “tree-walk: be more specific about corrupt tree errors”
  1. 1/3 tree-walk: be more specific about corrupt tree errorsDavid Turner, Sep 27, 2016
  2. 2/3 fsck: handle bad trees like other errorsDavid Turner, Sep 27, 2016
  3. Jeff KingSep 27, 2016
  4. 3/3 add David Turner's Two Sigma addressDavid Turner, Sep 27, 2016
  5. Junio C HamanoSep 27, 2016
  6. Junio C HamanoSep 27, 2016
  7. Jeff KingSep 27, 2016

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.