aboutsummaryrefslogtreecommitdiff
path: root/blob.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-12-08 05:47:08 -0500
committerJunio C Hamano <gitster@pobox.com>2017-12-08 09:03:38 -0800
commit90c8a1db9d6e8f7d2e3e842142ba98f827d42800 (patch)
treefe115d2c56ec072501f7db92b2a4bf7988d4e9f0 /blob.h
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-90c8a1db9d6e8f7d2e3e842142ba98f827d42800.tar.gz
git-90c8a1db9d6e8f7d2e3e842142ba98f827d42800.tar.xz
test-lib: silence "-x" cleanup under bash
When the test suite's "-x" option is used with bash, we end up seeing cleanup cruft in the output: $ bash t0001-init.sh -x [...] ++ diff -u expected actual + test_eval_ret_=0 + want_trace + test t = t + test t = t + set +x ok 42 - re-init from a linked worktree This ranges from mildly annoying (for a successful test) to downright confusing (when we say "last command exited with error", but it's really 5 commands back). We normally are able to suppress this cleanup. As the in-code comment explains, we can't convince the shell not to print it, but we can redirect its stderr elsewhere. But since d88785e424 (test-lib: set BASH_XTRACEFD automatically, 2016-05-11), that doesn't hold for bash. It sends the "set -x" output directly to descriptor 4, not to stderr. We can fix this by also redirecting descriptor 4, and paying close attention to which commands redirected and which are not (see the updated comment). Two alternatives I considered and rejected: - unsetting and setting BASH_XTRACEFD; doing so closes the descriptor, which we must avoid - we could keep everything in a single block as before, redirect 4>/dev/null there, but retain 5>&4 as a copy. And then selectively restore 4>&5 for commands which should be allowed to trace. This would work, but the descriptor swapping seems unnecessarily confusing. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'blob.h')
0 files changed, 0 insertions, 0 deletions