aboutsummaryrefslogtreecommitdiffstats
path: root/t/t9850-shell.sh
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2022-10-06 17:42:55 -0400
committerTaylor Blau <me@ttaylorr.com>2022-10-06 17:42:55 -0400
commit478a426f14b92cef92fc09df442b356a53f6fa8f (patch)
tree1f2dcc827b46b148cc2305f48f35bb233d437fa7 /t/t9850-shell.sh
parentf2eed22852b0a21556f0c9f56732913eba553e62 (diff)
parent7800e1dccf622ba8d490b4c1c92af734be6242ff (diff)
downloadgit-478a426f14b92cef92fc09df442b356a53f6fa8f.tar.gz
Sync with 2.33.5
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 't/t9850-shell.sh')
-rwxr-xr-xt/t9850-shell.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t9850-shell.sh b/t/t9850-shell.sh
new file mode 100755
index 0000000000..cfc71c3bd4
--- /dev/null
+++ b/t/t9850-shell.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+test_description='git shell tests'
+. ./test-lib.sh
+
+test_expect_success 'shell allows upload-pack' '
+ printf 0000 >input &&
+ git upload-pack . <input >expect &&
+ git shell -c "git-upload-pack $SQ.$SQ" <input >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'shell forbids other commands' '
+ test_must_fail git shell -c "git config foo.bar baz"
+'
+
+test_expect_success 'shell forbids interactive use by default' '
+ test_must_fail git shell
+'
+
+test_expect_success 'shell allows interactive command' '
+ mkdir git-shell-commands &&
+ write_script git-shell-commands/ping <<-\EOF &&
+ echo pong
+ EOF
+ echo pong >expect &&
+ echo ping | git shell >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'shell complains of overlong commands' '
+ perl -e "print \"a\" x 2**12 for (0..2**19)" |
+ test_must_fail git shell 2>err &&
+ grep "too long" err
+'
+
+test_done