aboutsummaryrefslogtreecommitdiffstats
path: root/t/t7424-submodule-mixed-ref-formats.sh
blob: de8400755477416ebecdcd206a2f2f63d3afe51f (plain) (blame)
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
38
39
40
41
#!/bin/sh

test_description='submodules handle mixed ref storage formats'

. ./test-lib.sh

test_ref_format () {
	echo "$2" >expect &&
	git -C "$1" rev-parse --show-ref-format >actual &&
	test_cmp expect actual
}

for OTHER_FORMAT in files reftable
do
	if test "$OTHER_FORMAT" = "$GIT_DEFAULT_REF_FORMAT"
	then
		continue
	fi

test_expect_success 'setup' '
	git config set --global protocol.file.allow always
'

test_expect_success 'clone submodules with different ref storage format' '
	test_when_finished "rm -rf submodule upstream downstream" &&

	git init submodule &&
	test_commit -C submodule submodule-initial &&
	git init upstream &&
	git -C upstream submodule add "file://$(pwd)/submodule" &&
	git -C upstream commit -m "upstream submodule" &&

	git clone --no-recurse-submodules "file://$(pwd)/upstream" downstream &&
	test_ref_format downstream "$GIT_DEFAULT_REF_FORMAT" &&
	git -C downstream submodule update --init --ref-format=$OTHER_FORMAT &&
	test_ref_format downstream/submodule "$OTHER_FORMAT"
'

done

test_done