git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Stodulka <pstodulk@redhat.com>
To: git@vger.kernel.org
Cc: pstodulk@redhat.com
Subject: [PATCH 1/2] Add test for ls-tree with broken symlink under refs/heads
Date: Fri, 14 Oct 2016 15:16:51 +0200	[thread overview]
Message-ID: <1476451012-9925-2-git-send-email-pstodulk@redhat.com> (raw)
In-Reply-To: <1476451012-9925-1-git-send-email-pstodulk@redhat.com>

git ls-tree goes into an infinite loop while serving pretty vanilla requests,
if the refs/heads/ directory contains a symlink that's broken. Added test
which check if git ends with expected exit code or timeout expires.
---
 t/t3103-ls-tree-misc.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t3103-ls-tree-misc.sh b/t/t3103-ls-tree-misc.sh
index 09dcf04..faf79c4 100755
--- a/t/t3103-ls-tree-misc.sh
+++ b/t/t3103-ls-tree-misc.sh
@@ -21,4 +21,13 @@ test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '
 	test_must_fail git ls-tree -r HEAD
 '
 
+test_expect_success 'ls-tree fails due to broken symlink instead of infinite loop' '
+	mkdir foo_infinit &&
+	cd foo_infinit &&
+	git init testrepo &&
+	cd testrepo &&
+	mkdir -p .git/refs/remotes &&
+	ln -s ../remotes/foo .git/refs/heads/bar &&
+	test_expect_code 128 timeout 2 git ls-tree bar
+'
 test_done
-- 
2.5.5


  reply	other threads:[~2016-10-14 13:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 13:16 [PATCH 0/2] infinite loop in "git ls-tree" for broken symlink Petr Stodulka
2016-10-14 13:16 ` Petr Stodulka [this message]
2016-10-14 13:16 ` [PATCH 2/2] resolve_ref_unsafe(): limit the number of "stat_ref" retries Petr Stodulka
2016-10-14 13:20   ` Petr Stodulka
2016-10-14 13:42 ` [PATCH 0/2] infinite loop in "git ls-tree" for broken symlink Jeff King
2016-10-14 14:43   ` Petr Stodulka

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=1476451012-9925-2-git-send-email-pstodulk@redhat.com \
    --to=pstodulk@redhat.com \
    --cc=git@vger.kernel.org \
    /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).