From: Elijah Newren <newren@gmail.com>
To: git@vger.kernel.org
Cc: pclouds@gmail.com, peff@peff.net, Elijah Newren <newren@gmail.com>
Subject: [RFC PATCH 2/3] t1450-fsck: Add tests for HEAD of other worktrees
Date: Fri, 9 Feb 2018 15:13:29 -0800 [thread overview]
Message-ID: <20180209231330.4457-3-newren@gmail.com> (raw)
In-Reply-To: <20180209231330.4457-1-newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
t/t1450-fsck.sh | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index cb4b66e29d..fa94c59458 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -102,6 +102,33 @@ test_expect_success 'HEAD link pointing at a funny place' '
grep "HEAD points to something strange" out
'
+test_expect_failure 'other worktree HEAD link pointing at a funny object' '
+ test_when_finished "rm -rf .git/worktrees" &&
+ mkdir -p .git/worktrees/other &&
+ echo 0000000000000000000000000000000000000000 >.git/worktrees/other/HEAD &&
+ test_must_fail git fsck 2>out &&
+ cat out &&
+ grep "worktrees/other/HEAD: detached HEAD points" out
+'
+
+test_expect_failure 'other worktree HEAD link pointing at missing object' '
+ test_when_finished "rm -rf .git/worktrees" &&
+ mkdir -p .git/worktrees/other &&
+ echo "Contents missing from repo" | git hash-object --stdin >.git/worktrees/other/HEAD &&
+ test_must_fail git fsck 2>out &&
+ cat out &&
+ grep "worktrees/other/HEAD: invalid sha1 pointer" out
+'
+
+test_expect_failure 'other worktree HEAD link pointing at a funny place' '
+ test_when_finished "rm -rf .git/worktrees" &&
+ mkdir -p .git/worktrees/other &&
+ echo "ref: refs/funny/place" >.git/worktrees/other/HEAD &&
+ test_must_fail git fsck 2>out &&
+ cat out &&
+ grep "worktrees/other/HEAD points to something strange" out
+'
+
test_expect_success 'email without @ is okay' '
git cat-file commit HEAD >basis &&
sed "s/@/AT/" basis >okay &&
--
2.16.1.75.gc01c8fdd7d
next prev parent reply other threads:[~2018-02-09 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 23:13 [RFC PATCH 0/3] Make fsck check other worktree HEADs Elijah Newren
2018-02-09 23:13 ` [RFC PATCH 1/3] fsck: Move fsck_head_link() to get_default_heads() to avoid some globals Elijah Newren
2018-02-09 23:13 ` Elijah Newren [this message]
2018-02-09 23:13 ` [RFC PATCH 3/3] fsck: Check HEAD of other worktrees as well Elijah Newren
2018-02-10 9:59 ` Duy Nguyen
2018-02-10 12:34 ` Jeff King
2018-02-10 20:11 ` Junio C Hamano
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=20180209231330.4457-3-newren@gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
/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).