t5523-push-upstream: test progress messages
Reported-by: Chase Brammer <cbrammer@gmail.com> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Oct 17, 2010 at 02:37 UTC
8ac3ed27d4ca6b3c89c51e4d90e2e7be5de5ab15
1 file changed
+38
t/t5523-push-upstream.sh
+38
@@ -2,6 +2,7 @@
2
3
test_description='push with --set-upstream'
4
. ./test-lib.sh
5
+. "$TEST_DIRECTORY"/lib-terminal.sh
6
7
ensure_fresh_upstream() {
8
rm -rf parent && git init --bare parent
@@ -70,4 +71,41 @@ test_expect_success 'push -u HEAD' '
71
check_config headbranch upstream refs/heads/headbranch
72
'
73
74
+test_expect_success TTY 'progress messages go to tty' '
75
+ ensure_fresh_upstream &&
76
+
77
+ test_terminal git push -u upstream master >out 2>err &&
78
+ grep "Writing objects" err
79
+'
80
+
81
+test_expect_failure 'progress messages do not go to non-tty' '
82
+ ensure_fresh_upstream &&
83
+
84
+ # skip progress messages, since stderr is non-tty
85
+ git push -u upstream master >out 2>err &&
86
+ ! grep "Writing objects" err
87
+'
88
+
89
+test_expect_failure 'progress messages go to non-tty (forced)' '
90
+ ensure_fresh_upstream &&
91
+
92
+ # force progress messages to stderr, even though it is non-tty
93
+ git push -u --progress upstream master >out 2>err &&
94
+ grep "Writing objects" err
95
+'
96
+
97
+test_expect_success TTY 'push -q suppresses progress' '
98
+ ensure_fresh_upstream &&
99
+
100
+ test_terminal git push -u -q upstream master >out 2>err &&
101
+ ! grep "Writing objects" err
102
+'
103
+
104
+test_expect_failure TTY 'push --no-progress suppresses progress' '
105
+ ensure_fresh_upstream &&
106
+
107
+ test_terminal git push -u --no-progress upstream master >out 2>err &&
108
+ ! grep "Writing objects" err
109
+'
110
+
111
test_done