Skip to content

Commit 8ac3ed2

Browse files
rctaygitster
authored andcommitted
t5523-push-upstream: test progress messages
Reported-by: Chase Brammer <[email protected]> Signed-off-by: Tay Ray Chuan <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2d59ced commit 8ac3ed2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

t/t5523-push-upstream.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
test_description='push with --set-upstream'
44
. ./test-lib.sh
5+
. "$TEST_DIRECTORY"/lib-terminal.sh
56

67
ensure_fresh_upstream() {
78
rm -rf parent && git init --bare parent
@@ -70,4 +71,41 @@ test_expect_success 'push -u HEAD' '
7071
check_config headbranch upstream refs/heads/headbranch
7172
'
7273

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+
73111
test_done

0 commit comments

Comments
 (0)