]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9850-shell.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t9850-shell.sh
1 #!/bin/sh
2
3 test_description='git shell tests'
4 . ./test-lib.sh
5
6 test_expect_success 'shell allows upload-pack' '
7 printf 0000 >input &&
8 git upload-pack . <input >expect &&
9 git shell -c "git-upload-pack $SQ.$SQ" <input >actual &&
10 test_cmp expect actual
11 '
12
13 test_expect_success 'shell forbids other commands' '
14 test_must_fail git shell -c "git config foo.bar baz"
15 '
16
17 test_expect_success 'shell forbids interactive use by default' '
18 test_must_fail git shell
19 '
20
21 test_expect_success 'shell allows interactive command' '
22 mkdir git-shell-commands &&
23 write_script git-shell-commands/ping <<-\EOF &&
24 echo pong
25 EOF
26 echo pong >expect &&
27 echo ping | git shell >actual &&
28 test_cmp expect actual
29 '
30
31 test_expect_success 'shell complains of overlong commands' '
32 perl -e "print \"a\" x 2**12 for (0..2**19)" |
33 test_must_fail git shell 2>err &&
34 grep "too long" err
35 '
36
37 test_done