git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 1/4] t5541-http-push: add test for chunked

From
Tay Ray Chuan <rctay89@gmail.com>
Date
May 3, 2011, 15:47 UTC
Message-ID
<1304437649-7052-2-git-send-email-rctay89@gmail.com>
In-Reply-To
<1304437649-7052-1-git-send-email-rctay89@gmail.com>

Trigger the chunked type of pushing for smart HTTP. This can serve as a regression test for the issue fixed in 1e41827 (http: clear POSTFIELDS when initializing a slot).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
New.
 t/t5541-http-push.sh |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index 0492877..f589221 100755
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
@@ -65,14 +65,16 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/smart/test_repo.git test_repo_clone
 '
 
-test_expect_success 'push to remote repository' '
+test_expect_success 'push to remote repository (standard)' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
 	HEAD=$(git rev-parse --verify HEAD) &&
-	git push &&
+	GIT_CURL_VERBOSE=1 git push -v -v 2>err &&
+	! grep "Expect: 100-continue" err &&
+	grep "POST git-receive-pack (376 bytes)" err &&
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
 	 test $HEAD = $(git rev-parse --verify HEAD))
 '
@@ -140,5 +142,27 @@ test_expect_success C_LOCALE_OUTPUT 'push fails for non-fast-forward refs unmatc
 		output
 '
 
+test_expect_success 'push (chunked)' '
+	BRANCH=master-chunked &&
+	REPO=test_repo_chunked &&
+
+	(cd "$HTTPD_DOCUMENT_ROOT_PATH" &&
+	 cp -R test_repo.git $REPO) &&
+	git remote set-url origin $HTTPD_URL/smart/$REPO &&
+
+	# to trigger chunked pushing, we need a sufficiently large pack - use
+	# git v0.99
+	GIT_REPO=$TEST_DIRECTORY/../.git &&
+	test -d $GIT_REPO &&
+	echo $GIT_REPO/objects > .git/objects/info/alternates &&
+	git fetch $GIT_REPO refs/tags/v0.99 &&
+	git branch $BRANCH FETCH_HEAD &&
+	BRANCH_REF=$(git rev-parse --verify refs/heads/$BRANCH) &&
+	git push -v -v origin $BRANCH 2>err &&
+	grep "POST git-receive-pack (chunked)" err &&
+	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/$REPO &&
+	 test $BRANCH_REF = $(git rev-parse --verify refs/heads/$BRANCH))
+'
+
 stop_httpd
 test_done
-- 
1.7.3.3.585.g74f6e
Previous: Tay Ray ChuanNext: Tay Ray Chuan
Message 2 of 20 in “http cleanups”
  1. 0/4 http cleanupsTay Ray Chuan, May 3, 2011
  2. 1/4 t5541-http-push: add test for chunkedTay Ray Chuan, May 3, 2011
  3. 2/4 http: make curl callbacks match contracts from curl headerTay Ray Chuan, May 3, 2011
  4. 3/4 http-push: use const for strings in signaturesTay Ray Chuan, May 3, 2011
  5. 4/4 http-push: refactor curl_easy_setup madnessTay Ray Chuan, May 3, 2011
  6. Shawn PearceMay 3, 2011
  7. Tay Ray ChuanMay 3, 2011
  8. Junio C HamanoMay 4, 2011
  9. Junio C HamanoMay 4, 2011
  10. Tay Ray ChuanMay 4, 2011
  11. 0/4 http cleanupsTay Ray Chuan, May 4, 2011
  12. 1/4 t5541-http-push: add test for chunkedTay Ray Chuan, May 4, 2011
  13. 2/4 http: make curl callbacks match contracts from curl headerTay Ray Chuan, May 4, 2011
  14. 3/4 http-push: use const for strings in signaturesTay Ray Chuan, May 4, 2011
  15. 4/4 http-push: refactor curl_easy_setup madnessTay Ray Chuan, May 4, 2011
  16. Jakub NarebskiMay 4, 2011
  17. Junio C HamanoMay 4, 2011
  18. Junio C HamanoMay 4, 2011
  19. Junio C HamanoMay 4, 2011
  20. Junio C HamanoMay 4, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.