blob 1ec26c3d05ee809222d65523242eaef5aeea4fec 2511 bytes (raw)
name: t/t7410-submodule-config.sh # note: path name is non-authoritative(*)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
| | #!/bin/sh
#
# Copyright (c) 2014 Heiko Voigt
#
test_description='Test submodules config cache infrastructure
This test verifies that parsing .gitmodules configurations directly
from the database and from the worktree works.
'
TEST_NO_CREATE_REPO=1
. ./test-lib.sh
test_expect_success 'submodule config cache setup' '
mkdir submodule &&
(cd submodule &&
git init
echo a >a &&
git add . &&
git commit -ma
) &&
mkdir super &&
(cd super &&
git init &&
git submodule add ../submodule &&
git submodule add ../submodule a &&
git commit -m "add as submodule and as a" &&
git mv a b &&
git commit -m "move a to b"
)
'
cat >super/expect <<EOF
Submodule name: 'a' for path 'a'
Submodule name: 'a' for path 'b'
Submodule name: 'submodule' for path 'submodule'
Submodule name: 'submodule' for path 'submodule'
EOF
test_expect_success 'test parsing of submodule config' '
(cd super &&
test-submodule-config \
HEAD^ a \
HEAD b \
HEAD^ submodule \
HEAD submodule \
>actual &&
test_cmp expect actual
)
'
cat >super/expect_error <<EOF
Submodule name: 'a' for path 'b'
Submodule name: 'submodule' for path 'submodule'
EOF
test_expect_success 'error in one submodule config lets continue' '
(cd super &&
cp .gitmodules .gitmodules.bak &&
echo " value = \"" >>.gitmodules &&
git add .gitmodules &&
mv .gitmodules.bak .gitmodules &&
git commit -m "add error" &&
test-submodule-config \
HEAD b \
HEAD submodule \
>actual &&
test_cmp expect_error actual
)
'
cat >super/expect_url <<EOF
Submodule url: 'git@somewhere.else.net:a.git' for path 'b'
Submodule url: 'git@somewhere.else.net:submodule.git' for path 'submodule'
EOF
cat >super/expect_local_path <<EOF
Submodule name: 'a' for path 'c'
Submodule name: 'submodule' for path 'submodule'
EOF
test_expect_success 'reading of local configuration' '
(cd super &&
old_a=$(git config submodule.a.url) &&
old_submodule=$(git config submodule.submodule.url) &&
git config submodule.a.url git@somewhere.else.net:a.git &&
git config submodule.submodule.url git@somewhere.else.net:submodule.git &&
test-submodule-config --url \
"" b \
"" submodule \
>actual &&
test_cmp expect_url actual &&
git config submodule.a.path c &&
test-submodule-config \
"" c \
"" submodule \
>actual &&
test_cmp expect_local_path actual &&
git config submodule.a.url $old_a &&
git config submodule.submodule.url $old_submodule &&
git config --unset submodule.a.path c
)
'
test_done
|
debug log:
solving 1ec26c3 ...
found 1ec26c3 in https://public-inbox.org/git/20140605060913.GE23874@sandbox-ub/
found ea453c5 in https://public-inbox.org/git/20140605060750.GC23874@sandbox-ub/
applying [1/2] https://public-inbox.org/git/20140605060750.GC23874@sandbox-ub/
diff --git a/t/t7410-submodule-config.sh b/t/t7410-submodule-config.sh
new file mode 100755
index 0000000..ea453c5
applying [2/2] https://public-inbox.org/git/20140605060913.GE23874@sandbox-ub/
diff --git a/t/t7410-submodule-config.sh b/t/t7410-submodule-config.sh
index ea453c5..1ec26c3 100755
Checking patch t/t7410-submodule-config.sh...
Applied patch t/t7410-submodule-config.sh cleanly.
Checking patch t/t7410-submodule-config.sh...
Applied patch t/t7410-submodule-config.sh cleanly.
index at:
100755 1ec26c3d05ee809222d65523242eaef5aeea4fec t/t7410-submodule-config.sh
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).