Merge branch 'ew/connect-verbose'
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2016 21:14:33 +0000 (13:14 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2016 21:14:33 +0000 (13:14 -0800)
* ew/connect-verbose:
t5570: add tests for "git {clone,fetch,pull} -v"

1  2 
t/t5570-git-daemon.sh
diff --combined t/t5570-git-daemon.sh
index d76269a8fc96a874042cd2e070794e2c56577468,8621feeaa9389648980202913f02e568c5fbcc5c..225a022e8a8fe063bc9cb8b8b282323f95bb18e3
@@@ -6,6 -6,12 +6,12 @@@ test_description='test fetching over gi
  . "$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 +30,8 @@@ test_expect_success 'create git-accessi
  '
  
  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 +39,21 @@@ test_expect_success 'fetch changes via 
        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 &&
@@@ -57,7 -75,7 +75,7 @@@ test_expect_success 'prepare pack objec
  test_expect_success 'fetch notices corrupt pack' '
        cp -R "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_bad1.git &&
        (cd "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_bad1.git &&
 -       p=`ls objects/pack/pack-*.pack` &&
 +       p=$(ls objects/pack/pack-*.pack) &&
         chmod u+w $p &&
         printf %0256d 0 | dd of=$p bs=256 count=1 seek=1 conv=notrunc
        ) &&
        (cd repo_bad1.git &&
         git --bare init &&
         test_must_fail git --bare fetch "$GIT_DAEMON_URL/repo_bad1.git" &&
 -       test 0 = `ls objects/pack/pack-*.pack | wc -l`
 +       test 0 = $(ls objects/pack/pack-*.pack | wc -l)
        )
  '
  
  test_expect_success 'fetch notices corrupt idx' '
        cp -R "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_pack.git "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_bad2.git &&
        (cd "$GIT_DAEMON_DOCUMENT_ROOT_PATH"/repo_bad2.git &&
 -       p=`ls objects/pack/pack-*.idx` &&
 +       p=$(ls objects/pack/pack-*.idx) &&
         chmod u+w $p &&
         printf %0256d 0 | dd of=$p bs=256 count=1 seek=1 conv=notrunc
        ) &&
@@@ -80,7 -98,7 +98,7 @@@
        (cd repo_bad2.git &&
         git --bare init &&
         test_must_fail git --bare fetch "$GIT_DAEMON_URL/repo_bad2.git" &&
 -       test 0 = `ls objects/pack | wc -l`
 +       test 0 = $(ls objects/pack | wc -l)
        )
  '