|
2 | 2 |
|
3 | 3 | test_description='push with --set-upstream' |
4 | 4 | . ./test-lib.sh |
| 5 | +. "$TEST_DIRECTORY"/lib-terminal.sh |
5 | 6 |
|
6 | 7 | ensure_fresh_upstream() { |
7 | 8 | rm -rf parent && git init --bare parent |
@@ -70,4 +71,41 @@ test_expect_success 'push -u HEAD' ' |
70 | 71 | check_config headbranch upstream refs/heads/headbranch |
71 | 72 | ' |
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 | + |
73 | 111 | test_done |
0 commit comments