From: Jeff King <peff@peff.net>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: Dennis Kaarsemaker <dennis@kaarsemaker.net>,
gitster@pobox.com, git@vger.kernel.org
Subject: [PATCH v2 2/3] t5551: factor out tag creation
Date: Wed, 20 May 2015 03:36:43 -0400 [thread overview]
Message-ID: <20150520073643.GB9818@peff.net> (raw)
In-Reply-To: <20150520073526.GA16784@peff.net>
One of our tests in t5551 creates a large number of tags,
and jumps through some hoops to do it efficiently. Let's
factor that out into a function so we can make other similar
tests.
Signed-off-by: Jeff King <peff@peff.net>
---
t/t5551-http-fetch-smart.sh | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 66439e5..c83cdf4 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -224,27 +224,35 @@ test_expect_success 'transfer.hiderefs works over smart-http' '
git -C hidden.git rev-parse --verify b
'
-test_expect_success 'create 2,000 tags in the repo' '
- (
- cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
- for i in $(test_seq 2000)
+# create an arbitrary number of tags, numbered from tag-$1 to tag-$2
+create_tags () {
+ rm -f marks &&
+ for i in $(test_seq "$1" "$2")
do
- echo "commit refs/heads/too-many-refs"
- echo "mark :$i"
- echo "committer git <git@example.com> $i +0000"
- echo "data 0"
- echo "M 644 inline bla.txt"
- echo "data 4"
- echo "bla"
+ # don't use here-doc, because it requires a process
+ # per loop iteration
+ echo "commit refs/heads/too-many-refs-$1" &&
+ echo "mark :$i" &&
+ echo "committer git <git@example.com> $i +0000" &&
+ echo "data 0" &&
+ echo "M 644 inline bla.txt" &&
+ echo "data 4" &&
+ echo "bla" &&
# make every commit dangling by always
# rewinding the branch after each commit
- echo "reset refs/heads/too-many-refs"
- echo "from :1"
+ echo "reset refs/heads/too-many-refs-$1" &&
+ echo "from :$1"
done | git fast-import --export-marks=marks &&
# now assign tags to all the dangling commits we created above
tag=$(perl -e "print \"bla\" x 30") &&
sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
+}
+
+test_expect_success 'create 2,000 tags in the repo' '
+ (
+ cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ create_tags 1 2000
)
'
--
2.4.1.396.g7ba6d7b
next prev parent reply other threads:[~2015-05-20 7:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 21:04 Clone hangs when done over http with --reference Konstantin Ryabitsev
2015-05-14 0:47 ` Jeff King
2015-05-14 1:02 ` [PATCH] http-backend: fix die recursion with custom handler Jeff King
2015-05-15 6:20 ` Jeff King
2015-05-14 17:08 ` Clone hangs when done over http with --reference Konstantin Ryabitsev
2015-05-14 19:52 ` Jeff King
2015-05-15 6:29 ` [PATCH 0/2] fix http deadlock on giant ref negotiations Jeff King
2015-05-15 6:29 ` [PATCH 1/2] http-backend: fix die recursion with custom handler Jeff King
2015-05-15 6:33 ` [PATCH 2/2] http-backend: spool ref negotiation requests to buffer Jeff King
2015-05-15 18:22 ` Junio C Hamano
2015-05-15 18:28 ` Konstantin Ryabitsev
2015-05-20 7:35 ` [PATCH v2 0/3] fix http deadlock on giant ref negotiations Jeff King
2015-05-20 7:36 ` [PATCH v2 1/3] http-backend: fix die recursion with custom handler Jeff King
2015-05-20 7:36 ` Jeff King [this message]
2015-05-20 7:37 ` [PATCH v2 3/3] http-backend: spool ref negotiation requests to buffer Jeff King
2015-05-26 2:07 ` Konstantin Ryabitsev
2015-05-26 2:24 ` Jeff King
2015-05-26 3:43 ` Junio C Hamano
2015-05-15 19:16 ` [PATCH 2/2] " Jeff King
2015-05-15 7:41 ` [PATCH 0/2] fix http deadlock on giant ref negotiations Dennis Kaarsemaker
2015-05-15 8:38 ` Jeff King
2015-05-15 8:44 ` Dennis Kaarsemaker
2015-05-15 8:53 ` Jeff King
2015-05-15 9:11 ` Dennis Kaarsemaker
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150520073643.GB9818@peff.net \
--to=peff@peff.net \
--cc=dennis@kaarsemaker.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=konstantin@linuxfoundation.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).