Skip to content

Commit 15335d3

Browse files
committed
more tests
1 parent 072a5fb commit 15335d3

File tree

1 file changed

+129
-41
lines changed

1 file changed

+129
-41
lines changed

Diff for: shallow-submodule.sh

+129-41
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,41 @@ mkdir tmp
1414
cd tmp
1515
rm -rf *
1616

17+
export GIT_AUTHOR_NAME="Ciro Santilli"
18+
export GIT_AUTHOR_EMAIL="[email protected]"
19+
export GIT_AUTHOR_DATE='2000-01-01T00:00:00+0000'
20+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
21+
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
22+
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
23+
1724
mkdir mod
18-
cd mod/
25+
cd mod
1926
git init
20-
touch a
21-
git add a
22-
git commit -m 1
23-
touch b
24-
git add b
25-
git commit -m 2
27+
touch base
28+
git add base
29+
git commit -m base
30+
touch master-1
31+
git add master-1
32+
git commit -m master-1
33+
touch master-2
34+
git add master-2
35+
git commit -m master-2
36+
git tag tag-master
37+
touch master-3
38+
git add master-3
39+
git commit -m master-3
40+
git checkout -b mybranch HEAD~3
41+
touch mybranch-1
42+
git add mybranch-1
43+
git commit -m mybranch-1
44+
touch mybranch-2
45+
git add mybranch-2
46+
git commit -m mybranch-2
47+
git tag tag-mybranch
48+
touch mybranch-3
49+
git add mybranch-3
50+
git commit -m mybranch-3
51+
git checkout master
2652
cd ..
2753

2854
mkdir top
@@ -46,63 +72,125 @@ git add .gitmodules
4672
git commit -m 'shallow'
4773
cd ..
4874

49-
mkdir mod-branch
50-
cd mod-branch/
75+
mkdir top-branch
76+
cd top-branch
5177
git init
5278
touch a
5379
git add a
5480
git commit -m 1
5581
touch b
5682
git add b
5783
git commit -m 2
58-
git checkout -b mybranch HEAD~
59-
touch c
60-
git add c
61-
git commit -m 3
84+
git submodule add -b mybranch ../mod/ mod
85+
git add .gitmodules
86+
git commit -m '.gitmodules'
6287
cd ..
6388

64-
mkdir top-branch
65-
cd top-branch
89+
cp -rv top-branch top-branch-shallow
90+
cd top-branch-shallow
91+
printf '\tshallow = true\n' >> .gitmodules
92+
git add .gitmodules
93+
git commit -m 'shallow'
94+
cd ..
95+
96+
mkdir top-tag
97+
cd top-tag
6698
git init
6799
touch a
68100
git add a
69101
git commit -m 1
70102
touch b
71103
git add b
72104
git commit -m 2
73-
git submodule add -b mybranch ../mod-branch/ mod
74-
git add .gitmodules
105+
git submodule add ../mod/ mod
106+
cd mod
107+
git checkout tag-mybranch
108+
cd ..
109+
git add .
75110
git commit -m '.gitmodules'
76111
cd ..
77112

78-
cp -rv top-branch top-branch-shallow
79-
cd top-branch-shallow
80-
printf '\tshallow = true\n' >> .gitmodules
81-
git add .gitmodules
82-
git commit -m 'shallow'
113+
mkdir top-sha
114+
cd top-sha
115+
git init
116+
touch a
117+
git add a
118+
git commit -m 1
119+
touch b
120+
git add b
121+
git commit -m 2
122+
git submodule add ../mod/ mod
123+
cd mod
124+
git checkout tag-mybranch~
125+
cd ..
126+
git add .
127+
git commit -m '.gitmodules'
83128
cd ..
84129

85-
git clone --recursive "file://$(pwd)/top" top-clone
86-
git --git-dir top-clone/.git/modules/mod log
87-
# two commits
130+
rm -f results
88131

89-
git clone --recursive "file://$(pwd)/top-shallow" top-shallow-clone
90-
git --git-dir top-shallow-clone/.git/modules/mod log
91-
# one commit
132+
git clone --depth 1 "file://$(pwd)/mod" mod-clone
133+
git --git-dir mod-clone/.git log --oneline | wc -l >>results
134+
# 1
92135

93-
git clone --recursive "file://$(pwd)/top-branch" top-branch-clone
94-
git --git-dir top-branch-clone/.git/modules/mod log
95-
# two commits
136+
git clone --depth 1 "file://$(pwd)/mod" mod-branch-clone
137+
git --git-dir mod-branch-clone/.git log --oneline | wc -l >>results
138+
# 1
96139

97-
git clone --recursive "file://$(pwd)/top-branch-shallow" top-branch-shallow-clone
98-
git --git-dir top-branch-shallow-clone/.git/modules/mod log
99-
# locally: one commit
100-
# github 2017-11, git 2.14.1: two commits
140+
## gitmodule
101141

102-
git clone --depth 1 "file://$(pwd)/mod" mod-clone
103-
git --git-dir mod-clone/.git log
104-
# one commit
142+
echo 'gitmodule' >>results
143+
144+
git clone --recurse-submodules "file://$(pwd)/top" top-clone
145+
git --git-dir top-clone/.git/modules/mod log --oneline | wc -l >>results
146+
# many
147+
148+
git clone --recurse-submodules "file://$(pwd)/top-shallow" top-shallow-clone
149+
git --git-dir top-shallow-clone/.git/modules/mod log --oneline | wc -l >>results
150+
# 1
151+
152+
git clone --recurse-submodules "file://$(pwd)/top-branch" top-branch-clone
153+
git --git-dir top-branch-clone/.git/modules/mod log --oneline | wc -l >>results
154+
# many
155+
156+
git clone --recurse-submodules "file://$(pwd)/top-branch-shallow" top-branch-shallow-clone
157+
git --git-dir top-branch-shallow-clone/.git/modules/mod log --oneline | wc -l >>results
158+
# many
159+
160+
git clone --recurse-submodules "file://$(pwd)/top-tag" top-tag-clone
161+
git --git-dir top-tag-clone/.git/modules/mod log --oneline | wc -l >>results
162+
# many
163+
164+
git clone --recurse-submodules "file://$(pwd)/top-sha" top-sha-clone
165+
git --git-dir top-sha-clone/.git/modules/mod log --oneline | wc -l >>results
166+
# many
167+
168+
## SS
169+
170+
echo 'ss' >>results
171+
172+
git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top" top-clone-ss
173+
git --git-dir top-clone-ss/.git/modules/mod log --oneline | wc -l >>results
174+
# 1
175+
176+
git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top-shallow" top-shallow-clone-ss
177+
git --git-dir top-shallow-clone-ss/.git/modules/mod log --oneline | wc -l >>results
178+
# 1
179+
180+
git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top-branch" top-branch-clone-ss
181+
git --git-dir top-branch-clone-ss/.git/modules/mod log --oneline | wc -l >>results
182+
# 1
183+
184+
git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top-branch-shallow" top-branch-shallow-clone-ss
185+
git --git-dir top-branch-shallow-clone-ss/.git/modules/mod log --oneline | wc -l >>results
186+
# 1
187+
188+
git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top-tag" top-tag-clone-ss
189+
git --git-dir top-tag-clone-ss/.git/modules/mod log --oneline | wc -l >>results
190+
# 1
191+
192+
#git clone --recurse-submodules --shallow-submodules "file://$(pwd)/top-sha" top-sha-clone-ss
193+
# error: Server does not allow request for unadvertised object
194+
#git --git-dir top-sha-clone-ss/.git/modules/mod log --oneline | wc -l >>results
105195

106-
git clone --depth 1 "file://$(pwd)/mod-branch" mod-branch-clone
107-
git --git-dir mod-branch-clone/.git log
108-
# one commit
196+
cat results

0 commit comments

Comments
 (0)