From: Jeff King Date: Tue, 27 Sep 2016 19:03:26 GMT Subject: Re: [PATCH v3 2/3] fsck: handle bad trees like other errors 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: > +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