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

[PATCH v2] t5570: add tests for "git {clone,fetch,pull} -v"

From
EWEric Wong <normalperson@yhbt.net>
Date
Feb 14, 2016, 09:26 UTC
Message-ID
<20160214092629.GA1909@dcvr.yhbt.net>
In-Reply-To
<xmqqtwlcs5e6.fsf@gitster.mtv.corp.google.com>

Now that git_connect is more information about connectivity progress after: ("pass transport verbosity down to git_connect") we should ensure it remains so for future users who need to to diagnose networking problems.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
  Thanks for the feedback, v2 changes as suggested:
  - remove -q flag from grep invocation for verbose git tests
  - do not remove stderr file after testing
  - fold verbosity check into existing tests for skip-ability
 t/t5570-git-daemon.sh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index d76269a..225a022 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -6,6 +6,12 @@ test_description='test fetching over git protocol'
 . "$TEST_DIRECTORY"/lib-git-daemon.sh
 start_git_daemon
 
+check_verbose_connect () {
+	grep -F "Looking up 127.0.0.1 ..." stderr &&
+	grep -F "Connecting to 127.0.0.1 (port " stderr &&
+	grep -F "done." stderr
+}
+
 test_expect_success 'setup repository' '
 	git config push.default matching &&
 	echo content >file &&
@@ -24,7 +30,8 @@ test_expect_success 'create git-accessible bare repository' '
 '
 
 test_expect_success 'clone git repository' '
-	git clone "$GIT_DAEMON_URL/repo.git" clone &&
+	git clone -v "$GIT_DAEMON_URL/repo.git" clone 2>stderr &&
+	check_verbose_connect &&
 	test_cmp file clone/file
 '
 
@@ -32,10 +39,21 @@ test_expect_success 'fetch changes via git protocol' '
 	echo content >>file &&
 	git commit -a -m two &&
 	git push public &&
-	(cd clone && git pull) &&
+	(cd clone && git pull -v) 2>stderr &&
+	check_verbose_connect &&
 	test_cmp file clone/file
 '
 
+test_expect_success 'no-op fetch -v stderr is as expected' '
+	(cd clone && git fetch -v) 2>stderr &&
+	check_verbose_connect
+'
+
+test_expect_success 'no-op fetch without "-v" is quiet' '
+	(cd clone && git fetch) 2>stderr &&
+	! test -s stderr
+'
+
 test_expect_success 'remote detects correct HEAD' '
 	git push public master:other &&
 	(cd clone &&
-- 
EW
Previous: Junio C Hamano
Message 5 of 5 in “Interim "What's cooking"”
  1. Junio C HamanoFeb 10, 2016
  2. Eric WongFeb 12, 2016
  3. t5570: add tests for "git fetch -v"Eric Wong, Feb 13, 2016
  4. Junio C HamanoFeb 13, 2016
  5. t5570: add tests for "git {clone,fetch,pull} -v"Eric Wong, Feb 14, 2016

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.