Raw
1 #!/bin/sh
2
3 test_description='git shell tests'
4
5 . ./test-lib.sh
6
7 test_expect_success 'shell allows upload-pack' '
8 printf 0000 >input &&
9 git upload-pack . <input >expect &&
10 git shell -c "git-upload-pack $SQ.$SQ" <input >actual &&
11 test_cmp expect actual
12 '
13
14 test_expect_success 'shell forbids other commands' '
15 test_must_fail git shell -c "git config foo.bar baz"
16 '
17
18 test_expect_success 'shell forbids interactive use by default' '
19 test_must_fail git shell
20 '
21
22 test_expect_success 'shell allows interactive command' '
23 mkdir git-shell-commands &&
24 write_script git-shell-commands/ping <<-\EOF &&
25 echo pong
26 EOF
27 echo pong >expect &&
28 echo ping | git shell >actual &&
29 test_cmp expect actual
30 '
31
32 test_expect_success 'shell complains of overlong commands' '
33 test-tool genzeros | tr "\000" "a" |
34 test_must_fail git shell 2>err &&
35 grep "too long" err
36 '
37
38 test_done