summaryrefslogtreecommitdiffstats
path: root/t/t9850-shell.sh
blob: cfc71c3bd4318758570f0aa7206d63fa71fedb4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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