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

[PATCH] t5551: do not use unportable sed '\+'

From
Junio C Hamano <gitster@pobox.com>
Date
May 12, 2013, 22:50 UTC
Message-ID
<7vr4hbu818.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<7vsj1svqi7.fsf@alter.siamese.dyndns.org>

The set-up step to prepare a repository with 50000 tags used a non-porable '\+' to match one-or-more.

The error was not caught because the next test that uses that repository did not even bother to check if these expected tags were actually cloned to the resulting repository.

Fix the sed construct to use BRE and update the "clone" test that wanted to test cloning from such a repository with many refs to check the resulting repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t5551-http-fetch.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index 47eb769..fe6637b 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -184,13 +184,17 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
 
 	# now assign tags to all the dangling commits we created above
 	tag=$("$PERL_PATH" -e "print \"bla\" x 30") &&
-	sed -e "s/^:\(.\+\) \(.\+\)$/\2 refs\/tags\/$tag-\1/" <marks >>packed-refs
+	sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
 	)
 '
 
 test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' '
 	git clone $HTTPD_URL/smart/repo.git too-many-refs 2>err &&
-	test_line_count = 0 err
+	test_line_count = 0 err &&
+	(
+		cd too-many-refs &&
+		test $(git for-each-ref refs/tags | wc -l) = 50000
+	)
 '
 
 stop_httpd
-- 
1.8.3-rc1-278-g19c008b
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 8 of 13 in “test-bzr: Do not use unportable sed "\+"”
  1. test-bzr: Do not use unportable sed "\+"Torsten Bögershausen, May 11, 2013
  2. Junio C HamanoMay 11, 2013
  3. Junio C HamanoMay 11, 2013
  4. Torsten BögershausenMay 11, 2013
  5. Junio C HamanoMay 11, 2013
  6. Torsten BögershausenMay 11, 2013
  7. Junio C HamanoMay 12, 2013
  8. t5551: do not use unportable sed '\+'Junio C Hamano, May 12, 2013
  9. Torsten BögershausenMay 13, 2013
  10. Junio C HamanoMay 13, 2013
  11. Torsten BögershausenMay 13, 2013
  12. Junio C HamanoMay 13, 2013
  13. Torsten BögershausenMay 11, 2013

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.