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

[PATCH 1/6] t5570: use ls-remote instead of clone for interp tests

From
Jeff King <peff@peff.net>
Date
Jan 25, 2018, 00:55 UTC
Message-ID
<20180125005504.GA26850@sigill.intra.peff.net>
In-Reply-To
<20180125005447.GA26661@sigill.intra.peff.net>

We don't actually care about the clone operation here; we just want to know if we were able to actually contact the remote repository. Using ls-remote does that more efficiently, and without us having to worry about managing the tmp.git directory.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t5570-git-daemon.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index 225a022e8a..f92ebc5cd5 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -167,23 +167,20 @@ test_expect_success 'access repo via interpolated hostname' '
 	git init --bare "$repo" &&
 	git push "$repo" HEAD &&
 	>"$repo"/git-daemon-export-ok &&
-	rm -rf tmp.git &&
 	GIT_OVERRIDE_VIRTUAL_HOST=localhost \
-		git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git &&
-	rm -rf tmp.git &&
+		git ls-remote "$GIT_DAEMON_URL/interp.git" &&
 	GIT_OVERRIDE_VIRTUAL_HOST=LOCALHOST \
-		git clone --bare "$GIT_DAEMON_URL/interp.git" tmp.git
+		git ls-remote "$GIT_DAEMON_URL/interp.git"
 '
 
 test_expect_success 'hostname cannot break out of directory' '
-	rm -rf tmp.git &&
 	repo="$GIT_DAEMON_DOCUMENT_ROOT_PATH/../escape.git" &&
 	git init --bare "$repo" &&
 	git push "$repo" HEAD &&
 	>"$repo"/git-daemon-export-ok &&
 	test_must_fail \
 		env GIT_OVERRIDE_VIRTUAL_HOST=.. \
-		git clone --bare "$GIT_DAEMON_URL/escape.git" tmp.git
+		git ls-remote "$GIT_DAEMON_URL/escape.git"
 '
 
 stop_git_daemon
-- 
2.16.1.273.gfdaa03aa74
Previous: Jeff KingNext: Jeff King
Message 2 of 13 in “off-by-one errors in git-daemon”
  1. 0/6 off-by-one errors in git-daemonJeff King, Jan 25, 2018
  2. 1/6 t5570: use ls-remote instead of clone for interp testsJeff King, Jan 25, 2018
  3. 2/6 t/lib-git-daemon: record daemon logJeff King, Jan 25, 2018
  4. Lucas WerkmeisterJan 25, 2018
  5. Jeff KingJan 25, 2018
  6. 3/6 daemon: fix off-by-one in logging extended attributesJeff King, Jan 25, 2018
  7. 4/6 daemon: handle NULs in extended attribute stringJeff King, Jan 25, 2018
  8. 5/6 t/lib-git-daemon: add network-protocol helpersJeff King, Jan 25, 2018
  9. 6/6 daemon: fix length computation in newline strippingJeff King, Jan 25, 2018
  10. Eric SunshineJan 25, 2018
  11. Jeff KingJan 26, 2018
  12. Junio C HamanoJan 25, 2018
  13. Jeff KingJan 25, 2018

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.