blob: 30bec4b5f9f286cd97c57b70e3635c6c5c8cf85a (
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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#!/bin/sh
test_description='unpack-objects'
. ./test-lib.sh
test_expect_success setup '
mkdir pub.git &&
GIT_DIR=pub.git git init --bare &&
GIT_DIR=pub.git git config receive.fsckobjects true &&
mkdir work &&
(
cd work &&
git init &&
mkdir -p gar/bage &&
(
cd gar/bage &&
git init &&
>junk &&
git add junk &&
git commit -m "Initial junk"
) &&
git add gar/bage &&
git commit -m "Initial superproject"
)
'
test_expect_success push '
(
cd work &&
git push ../pub.git master
)
'
test_expect_success 'push if submodule has no remote' '
(
cd work/gar/bage &&
>junk2 &&
git add junk2 &&
git commit -m "Second junk"
) &&
(
cd work &&
git add gar/bage &&
git commit -m "Second commit for gar/bage" &&
git push --recurse-submodules=check ../pub.git master
)
'
test_expect_success 'push fails if submodule commit not on remote' '
(
cd work/gar &&
git clone --bare bage ../../submodule.git &&
cd bage &&
git remote add origin ../../../submodule.git &&
git fetch &&
>junk3 &&
git add junk3 &&
git commit -m "Third junk"
) &&
(
cd work &&
git add gar/bage &&
git commit -m "Third commit for gar/bage" &&
test_must_fail git push --recurse-submodules=check ../pub.git master
)
'
test_expect_success 'push succeeds after commit was pushed to remote' '
(
cd work/gar/bage &&
git push origin master
) &&
(
cd work &&
git push --recurse-submodules=check ../pub.git master
)
'
test_expect_success 'push fails when commit on multiple branches if one branch has no remote' '
(
cd work/gar/bage &&
>junk4 &&
git add junk4 &&
git commit -m "Fourth junk"
) &&
(
cd work &&
git branch branch2 &&
git add gar/bage &&
git commit -m "Fourth commit for gar/bage" &&
git checkout branch2 &&
(
cd gar/bage &&
git checkout HEAD~1
) &&
>junk1 &&
git add junk1 &&
git commit -m "First junk" &&
test_must_fail git push --recurse-submodules=check ../pub.git
)
'
test_expect_success 'push succeeds if submodule has no remote and is on the first superproject commit' '
git init --bare a
git clone a a1 &&
(
cd a1 &&
git init b
(
cd b &&
>junk &&
git add junk &&
git commit -m "initial"
) &&
git add b &&
git commit -m "added submodule" &&
git push --recurse-submodule=check origin master
)
'
test_done
|