aboutsummaryrefslogtreecommitdiffstats
path: root/t/t0061-run-command.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-08 10:33:20 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-08 10:33:20 -0800
commit0cea3ad7186bbdc21864fbabfd19cdf3ae08d9cb (patch)
tree78d0640d85537aff27695bc0ab88610cfbdc4014 /t/t0061-run-command.sh
parentMerge branch 'en/xdiff-cleanup-2' into seen (diff)
parentreceive-pack: convert receive hooks to hook API (diff)
downloadgit-0cea3ad7186bbdc21864fbabfd19cdf3ae08d9cb.tar.gz
git-0cea3ad7186bbdc21864fbabfd19cdf3ae08d9cb.zip
Merge branch 'ar/run-command-hook' into seen
Use hook API to replace ad-hoc invocation of hook scripts with the run_command() API. Comments? * ar/run-command-hook: receive-pack: convert receive hooks to hook API receive-pack: convert update hooks to new API hooks: allow callers to capture output run-command: allow capturing of collated output reference-transaction: use hook API instead of run-command hook: allow overriding the ungroup option transport: convert pre-push to hook API hook: convert 'post-rewrite' hook in sequencer.c to hook API hook: provide stdin via callback run-command: add stdin callback for parallelization
Diffstat (limited to 't/t0061-run-command.sh')
-rwxr-xr-xt/t0061-run-command.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 76d4936a87..f133d71783 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -164,6 +164,44 @@ test_expect_success 'run_command runs ungrouped in parallel with more tasks than
test_line_count = 4 err
'
+test_expect_success 'run_command can divert output' '
+ test_when_finished rm sideband &&
+ test-tool run-command run-command-sideband 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+ test_must_be_empty actual &&
+ test_cmp expect sideband
+'
+
+test_expect_success 'run_command listens to stdin' '
+ cat >expect <<-\EOF &&
+ preloaded output of a child
+ listening for stdin:
+ sample stdin 1
+ sample stdin 0
+ preloaded output of a child
+ listening for stdin:
+ sample stdin 1
+ sample stdin 0
+ preloaded output of a child
+ listening for stdin:
+ sample stdin 1
+ sample stdin 0
+ preloaded output of a child
+ listening for stdin:
+ sample stdin 1
+ sample stdin 0
+ EOF
+
+ write_script stdin-script <<-\EOF &&
+ echo "listening for stdin:"
+ while read line
+ do
+ echo "$line"
+ done
+ EOF
+ test-tool run-command run-command-stdin 2 ./stdin-script 2>actual &&
+ test_cmp expect actual
+'
+
cat >expect <<-EOF
preloaded output of a child
asking for a quick stop