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

Re: [PATCH v2] Tolerate zlib deflation with window size < 32Kb

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2011, 19:23 UTC
Message-ID
<7v62m7yagb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1312742773-26373-1-git-send-email-roberto.tyley@gmail.com>
roberto.tyley@gmail.com writes:
Show 5 quoted lines
> +. ./test-lib.sh
> +
> +assert_blob_equals() {
> +	echo -n $2 > expected &&
> +	git cat-file -p $1 > actual &&
Needs proper quoting with dq.
Show 13 quoted lines
> +	test_cmp expected actual
> +}
> +
> +test_expect_success setup '
> +	cp -R ../t1013/objects .git/
> +	git --version
> +'
> +
> +test_expect_success 'read standard-format loose objects' '
> +	git cat-file tag 8d4e360d6c70fbd72411991c02a09c442cf7a9fa &&
> +	git cat-file commit 6baee0540ea990d9761a3eb9ab183003a71c3696 &&
> +	git ls-tree 7a37b887a73791d12d26c0d3e39568a8fb0fa6e8 &&
> +	assert_blob_equals "257cc5642cb1a054f08cc83f2d943e56fd3ebe99" "foo\n"
Isn't it unportable to expect "\n" to be kept or expanded by "echo"?

Will squash the following in (and I have another patch on top to consolidate the definition of $LF in this and other test scripts).

Thanks.
-- >8 --
Subject: [PATCH] fixup! Tolerate zlib deflation with window
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t1013-loose-object-format.sh |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/t/t1013-loose-object-format.sh b/t/t1013-loose-object-format.sh
index b5ac46d..36b4027 100755
--- a/t/t1013-loose-object-format.sh
+++ b/t/t1013-loose-object-format.sh
@@ -26,10 +26,12 @@ standard format, deflated with 4KB window size: Agit/JGit on Android
 '
 
 . ./test-lib.sh
+LF='
+'
 
 assert_blob_equals() {
-	echo -n $2 > expected &&
-	git cat-file -p $1 > actual &&
+	printf "%s" "$2" >expected &&
+	git cat-file -p "$1" >actual &&
 	test_cmp expected actual
 }
 
@@ -42,7 +44,7 @@ test_expect_success 'read standard-format loose objects' '
 	git cat-file tag 8d4e360d6c70fbd72411991c02a09c442cf7a9fa &&
 	git cat-file commit 6baee0540ea990d9761a3eb9ab183003a71c3696 &&
 	git ls-tree 7a37b887a73791d12d26c0d3e39568a8fb0fa6e8 &&
-	assert_blob_equals "257cc5642cb1a054f08cc83f2d943e56fd3ebe99" "foo\n"
+	assert_blob_equals "257cc5642cb1a054f08cc83f2d943e56fd3ebe99" "foo$LF"
 '
 
 test_expect_success 'read experimental-format loose objects' '
-- 
1.7.6.409.ge7a85
Previous: roberto.tyley@gmail.comNext: Junio C Hamano
Message 7 of 8 in “Tolerate zlib deflation with window size < 32Kb”
  1. Tolerate zlib deflation with window size < 32Kbroberto.tyley@gmail.com, Aug 3, 2011
  2. Junio C HamanoAug 3, 2011
  3. Roberto TyleyAug 4, 2011
  4. Sverre RabbelierAug 4, 2011
  5. Junio C HamanoAug 4, 2011
  6. Tolerate zlib deflation with window size < 32Kbroberto.tyley@gmail.com, Aug 7, 2011
  7. Junio C HamanoAug 8, 2011
  8. Junio C HamanoAug 8, 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.