From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/6] t1450: clean up sub-objects in duplicate-entry test
Date: Mon, 16 Jan 2017 16:24:03 -0500 [thread overview]
Message-ID: <20170116212403.l7ca7crmt47id3mu@sigill.intra.peff.net> (raw)
In-Reply-To: <20170116212231.ojoqzlajpszifaf3@sigill.intra.peff.net>
This test creates a multi-level set of trees, but its
cleanup routine only removes the top-level tree. After the
test finishes, the inner tree and the blob it points to
remain, making the inner tree dangling.
A later test ("cleaned up") verifies that we've removed any
cruft and "git fsck" output is clean. This passes only
because of a bug in git-fsck which fails to notice dangling
trees.
In preparation for fixing the bug, let's teach this earlier
test to clean up after itself correctly. We have to remove
the inner tree (and therefore the blob, too, which becomes
dangling after removing that tree).
Since the setup code happens inside a subshell, we can't
just set a variable for each object. However, we can stuff
all of the sha1s into the $T output variable, which is not
used for anything except cleanup.
Signed-off-by: Jeff King <peff@peff.net>
---
t/t1450-fsck.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index ee7d4736d..6eef8b28e 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -189,14 +189,16 @@ test_expect_success 'commit with NUL in header' '
'
test_expect_success 'tree object with duplicate entries' '
- test_when_finished "remove_object \$T" &&
+ test_when_finished "for i in \$T; do remove_object \$i; done" &&
T=$(
GIT_INDEX_FILE=test-index &&
export GIT_INDEX_FILE &&
rm -f test-index &&
>x &&
git add x &&
+ git rev-parse :x &&
T=$(git write-tree) &&
+ echo $T &&
(
git cat-file tree $T &&
git cat-file tree $T
--
2.11.0.642.gd6f8cda6c
next prev parent reply other threads:[~2017-01-16 21:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 21:22 [PATCH 0/6] fsck --connectivity-check misses some corruption Jeff King
2017-01-16 21:24 ` Jeff King [this message]
2017-01-17 20:52 ` [PATCH 1/6] t1450: clean up sub-objects in duplicate-entry test Junio C Hamano
2017-01-17 20:53 ` Jeff King
2017-01-16 21:25 ` [PATCH 2/6] fsck: report trees as dangling Jeff King
2017-01-17 20:57 ` Junio C Hamano
2017-01-16 21:32 ` [PATCH 3/6] fsck: prepare dummy objects for --connectivity-check Jeff King
2017-01-17 21:15 ` Junio C Hamano
2017-01-17 21:32 ` Jeff King
2017-01-17 21:16 ` Junio C Hamano
2017-01-16 21:33 ` [PATCH 4/6] fsck: tighten error-checks of "git fsck <head>" Jeff King
2017-01-17 21:17 ` Junio C Hamano
2017-01-16 21:34 ` [PATCH 5/6] fsck: do not fallback "git fsck <bogus>" to "git fsck" Jeff King
2017-01-16 21:34 ` [PATCH 6/6] fsck: check HAS_OBJ more consistently Jeff King
2017-01-16 23:26 ` [PATCH 0/6] fsck --connectivity-check misses some corruption Jeff King
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=20170116212403.l7ca7crmt47id3mu@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=mhagger@alum.mit.edu \
/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).