path: root/t/
diff options
authorJeff King <>2013-03-20 17:43:47 (GMT)
committerJunio C Hamano <>2013-03-21 15:03:32 (GMT)
commit2ad23273e71ff708936bd924502186b8789a7289 (patch)
treea1351171a6ea743791c532170a442c302f648617 /t/
parent2a4552021a92be17c7c4d2d2313df9913e8eb4bf (diff)
do not use GIT_TRACE_PACKET=3 in tests
Some test scripts use the GIT_TRACE mechanism to dump debugging information to descriptor 3 (and point it to a file using the shell). On Windows, however, bash is unable to set up descriptor 3. We do not write our trace to the file, and worse, we may interfere with other operations happening on descriptor 3, causing tests to fail or even behave inconsistently. Prior to commit 97a83fa (upload-pack: remove packet debugging harness), these tests used GIT_DEBUG_SEND_PACK, which only supported output to a descriptor. The tests in t5503 were always broken on Windows, and were marked to be skipped via the NOT_MINGW prerequisite. In t5700, the tests used to pass prior to 97a83fa, but only because they were not careful enough; because we only grepped the trace file, an empty file looked successful to us. But post-97a83fa, the writing to descriptor 3 causes "git fetch" to hang (presumably because we are throwing random bytes into the middle of the protocol). Now that we are using the GIT_TRACE mechanism, we can improve both scripts by asking git to write directly to a file rather than a descriptor. That fixes the hang in t5700, and should allow t5503 to successfully run on Windows. In both cases we now also use "test -s" to double-check that our trace file actually contains output, which should reduce the possibility of an erroneously passing test. Signed-off-by: Jeff King <> Tested-by: Johannes Sixt <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 9 insertions, 5 deletions
diff --git a/t/ b/t/
index 9cd3b4d..60f1552 100755
--- a/t/
+++ b/t/
@@ -54,11 +54,14 @@ cd "$base_dir"
rm -f "$U.D"
-test_expect_success 'cloning with reference (no -l -s)' \
-'GIT_TRACE_PACKET=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'
+test_expect_success 'cloning with reference (no -l -s)' '
+ GIT_TRACE_PACKET=$U.D git clone --reference B "file://$(pwd)/A" D
-test_expect_success 'fetched no objects' \
-'! grep " want" "$U.D"'
+test_expect_success 'fetched no objects' '
+ test -s "$U.D" &&
+ ! grep " want" "$U.D"
cd "$base_dir"
@@ -173,9 +176,10 @@ test_expect_success 'fetch with incomplete alternates' '
cd K &&
git remote add J "file://$base_dir/J" &&
- GIT_TRACE_PACKET=3 git fetch J 3>"$U.K"
+ GIT_TRACE_PACKET=$U.K git fetch J
) &&
master_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/master) &&
+ test -s "$U.K" &&
! grep " want $master_object" "$U.K" &&
tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
! grep " want $tag_object" "$U.K"