summaryrefslogtreecommitdiff
path: root/t/t7422-submodule-output.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t7422-submodule-output.sh')
-rwxr-xr-xt/t7422-submodule-output.sh40
1 files changed, 36 insertions, 4 deletions
diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh
index f21e920367..aea1ddf117 100755
--- a/t/t7422-submodule-output.sh
+++ b/t/t7422-submodule-output.sh
@@ -167,10 +167,42 @@ do
done
test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' '
- { git submodule status --recursive 2>err; echo $?>status; } |
- grep -q X/S &&
- test_must_be_empty err &&
- test_match_signal 13 "$(cat status)"
+ # The test setup is somewhat involved because triggering a SIGPIPE is
+ # racy with buffered pipes. To avoid the raciness we thus need to make
+ # sure that the subprocess in question fills the buffers completely,
+ # which requires a couple thousand submodules in total.
+ test_when_finished "rm -rf submodule repo" &&
+ git init submodule &&
+ (
+ cd submodule &&
+ test_commit initial &&
+
+ COMMIT=$(git rev-parse HEAD) &&
+ for i in $(test_seq 2000)
+ do
+ echo "[submodule \"sm-$i\"]" &&
+ echo "path = recursive-submodule-path-$i" ||
+ return 1
+ done >gitmodules &&
+ BLOB=$(git hash-object -w --stdin <gitmodules) &&
+
+ printf "100644 blob $BLOB\t.gitmodules\n" >tree &&
+ test_seq -f "160000 commit $COMMIT\trecursive-submodule-path-%d" 2000 >>tree &&
+ TREE=$(git mktree <tree) &&
+
+ COMMIT=$(git commit-tree "$TREE") &&
+ git reset --hard "$COMMIT"
+ ) &&
+
+ git init repo &&
+ (
+ cd repo &&
+ GIT_ALLOW_PROTOCOL=file git submodule add "$(pwd)"/../submodule &&
+ { git submodule status --recursive 2>err; echo $?>status; } |
+ grep -q recursive-submodule-path-1 &&
+ test_must_be_empty err &&
+ test_match_signal 13 "$(cat status)"
+ )
'
test_done