summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2018-02-23 23:39:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-27 20:43:14 (GMT)
commitc3a44562431515210197b1344d7285be2763e8f5 (patch)
tree6398769cb7f47fb8460296c6505fa9aa5dc843a6 /t
parent5fc98e79fc0c40a5d25cb988d3948c0c0ec9f8b8 (diff)
downloadgit-c3a44562431515210197b1344d7285be2763e8f5.zip
git-c3a44562431515210197b1344d7285be2763e8f5.tar.gz
git-c3a44562431515210197b1344d7285be2763e8f5.tar.bz2
t1507-rev-parse-upstream: don't check the stderr of a shell function
Three tests in 't1507-rev-parse-upstream.sh' fail when the test script is run with '-x' tracing (and using a shell other than a Bash version supporting BASH_XTRACEFD). The reason for those failures is that the tests check the stderr of the function 'error_message', which includes the trace of commands executed in that function as well, throwing off the comparison with the expected output. Save stderr of 'git rev-parse' only instead of the whole function, so it remains free from tracing output. After this change t1507 passes with '-x', even when running with /bin/sh. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1507-rev-parse-upstream.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index b23c4e3..2ce68cc 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -42,7 +42,7 @@ commit_subject () {
error_message () {
(cd clone &&
- test_must_fail git rev-parse --verify "$@")
+ test_must_fail git rev-parse --verify "$@" 2>../error)
}
test_expect_success '@{upstream} resolves to correct full name' '
@@ -159,8 +159,8 @@ test_expect_success 'branch@{u} error message when no upstream' '
cat >expect <<-EOF &&
fatal: no upstream configured for branch ${sq}non-tracking${sq}
EOF
- error_message non-tracking@{u} 2>actual &&
- test_i18ncmp expect actual
+ error_message non-tracking@{u} &&
+ test_i18ncmp expect error
'
test_expect_success '@{u} error message when no upstream' '
@@ -175,8 +175,8 @@ test_expect_success 'branch@{u} error message with misspelt branch' '
cat >expect <<-EOF &&
fatal: no such branch: ${sq}no-such-branch${sq}
EOF
- error_message no-such-branch@{u} 2>actual &&
- test_i18ncmp expect actual
+ error_message no-such-branch@{u} &&
+ test_i18ncmp expect error
'
test_expect_success '@{u} error message when not on a branch' '
@@ -192,8 +192,8 @@ test_expect_success 'branch@{u} error message if upstream branch not fetched' '
cat >expect <<-EOF &&
fatal: upstream branch ${sq}refs/heads/side${sq} not stored as a remote-tracking branch
EOF
- error_message bad-upstream@{u} 2>actual &&
- test_i18ncmp expect actual
+ error_message bad-upstream@{u} &&
+ test_i18ncmp expect error
'
test_expect_success 'pull works when tracking a local branch' '