[PATCH 5/7] t5540-http-push: check existence of fetched files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tay Ray Chuan <rctay89@xxxxxxxxx>
---
 t/t5540-http-push.sh |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index c7b8a40..ee7f84a 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -64,13 +64,18 @@ test_expect_success 'http-push fetches unpacked objects' '
 	git clone $HTTPD_URL/test_repo_unpacked.git \
 		"$ROOT_PATH"/fetch_unpacked &&

+	COMMIT_PATH=$(git rev-parse --verify HEAD |
+		sed -e "s/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)/\1\/\2/") &&
+
 	# By reset, we force git to retrieve the object
 	(cd "$ROOT_PATH"/fetch_unpacked &&
 	 git reset --hard HEAD^ &&
 	 git remote rm origin &&
 	 git reflog expire --expire=0 --all &&
 	 git prune &&
-	 git push -f -v $HTTPD_URL/test_repo_unpacked.git master)
+	 test ! -e ".git/objects/$COMMIT_PATH" &&
+	 git push -f -v $HTTPD_URL/test_repo_unpacked.git master &&
+	 test -e ".git/objects/$COMMIT_PATH")
 '

 test_expect_success 'http-push fetches packed objects' '
@@ -80,9 +85,14 @@ test_expect_success 'http-push fetches packed objects' '
 	git clone $HTTPD_URL/test_repo_packed.git \
 		"$ROOT_PATH"/test_repo_clone_packed &&

-	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
-	 git --bare repack &&
-	 git --bare prune-packed) &&
+	cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
+	git --bare repack &&
+	git --bare prune-packed &&
+
+	PACK_PATH=$(cat "objects/info/packs" |
+		sed -e "s/^P \(pack-[0-9a-f]\{40\}\.pack\)/\1/") &&
+	COMMIT_PATH=$(git rev-parse --verify HEAD |
+		sed -e "s/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)/\1\/\2/") &&

 	# By reset, we force git to retrieve the packed object
 	(cd "$ROOT_PATH"/test_repo_clone_packed &&
@@ -90,7 +100,10 @@ test_expect_success 'http-push fetches packed objects' '
 	 git remote rm origin &&
 	 git reflog expire --expire=0 --all &&
 	 git prune &&
-	 git push -f -v $HTTPD_URL/test_repo_packed.git master)
+	 test ! -e ".git/objects/$COMMIT_PATH" &&
+	 test ! -e ".git/objects/pack/$PACK_PATH" &&
+	 git push -f -v $HTTPD_URL/test_repo_packed.git master &&
+	 test -e ".git/objects/pack/$PACK_PATH")
 '

 test_expect_success 'create and delete remote branch' '
--
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]