@@ -130,16 +130,25 @@ test_expect_success 'single given branch clone' '
130130 test_must_fail git --git-dir=branch-a/.git rev-parse origin/B
131131'
132132
133+ test_expect_success ' clone shallow depth 1' '
134+ git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&
135+ test "`git --git-dir=shallow0/.git rev-list --count HEAD`" = 1
136+ '
137+
133138test_expect_success ' clone shallow' '
134139 git clone --no-single-branch --depth 2 "file://$(pwd)/." shallow
135140'
136141
142+ test_expect_success ' clone shallow depth count' '
143+ test "`git --git-dir=shallow/.git rev-list --count HEAD`" = 2
144+ '
145+
137146test_expect_success ' clone shallow object count' '
138147 (
139148 cd shallow &&
140149 git count-objects -v
141150 ) > count.shallow &&
142- grep "^in-pack: 18 " count.shallow
151+ grep "^in-pack: 12 " count.shallow
143152'
144153
145154test_expect_success ' clone shallow object count (part 2)' '
@@ -256,12 +265,36 @@ test_expect_success 'additional simple shallow deepenings' '
256265 )
257266'
258267
268+ test_expect_success ' clone shallow depth count' '
269+ test "`git --git-dir=shallow/.git rev-list --count HEAD`" = 11
270+ '
271+
259272test_expect_success ' clone shallow object count' '
260273 (
261274 cd shallow &&
262275 git count-objects -v
263276 ) > count.shallow &&
264- grep "^count: 52" count.shallow
277+ grep "^count: 55" count.shallow
278+ '
279+
280+ test_expect_success ' fetch --no-shallow on full repo' '
281+ test_must_fail git fetch --noshallow
282+ '
283+
284+ test_expect_success ' fetch --depth --no-shallow' '
285+ (
286+ cd shallow &&
287+ test_must_fail git fetch --depth=1 --noshallow
288+ )
289+ '
290+
291+ test_expect_success ' turn shallow to complete repository' '
292+ (
293+ cd shallow &&
294+ git fetch --unshallow &&
295+ ! test -f .git/shallow &&
296+ git fsck --full
297+ )
265298'
266299
267300test_expect_success ' clone shallow without --no-single-branch' '
@@ -273,15 +306,15 @@ test_expect_success 'clone shallow object count' '
273306 cd shallow2 &&
274307 git count-objects -v
275308 ) > count.shallow2 &&
276- grep "^in-pack: 6 " count.shallow2
309+ grep "^in-pack: 3 " count.shallow2
277310'
278311
279312test_expect_success ' clone shallow with --branch' '
280313 git clone --depth 1 --branch A "file://$(pwd)/." shallow3
281314'
282315
283316test_expect_success ' clone shallow object count' '
284- echo "in-pack: 6 " > count3.expected &&
317+ echo "in-pack: 3 " > count3.expected &&
285318 GIT_DIR=shallow3/.git git count-objects -v |
286319 grep "^in-pack" > count3.actual &&
287320 test_cmp count3.expected count3.actual
310343 GIT_DIR=shallow6/.git git tag -l >taglist.actual &&
311344 test_cmp taglist.expected taglist.actual &&
312345
313- echo "in-pack: 7 " > count6.expected &&
346+ echo "in-pack: 4 " > count6.expected &&
314347 GIT_DIR=shallow6/.git git count-objects -v |
315348 grep "^in-pack" > count6.actual &&
316349 test_cmp count6.expected count6.actual
325358 GIT_DIR=shallow7/.git git tag -l >taglist.actual &&
326359 test_cmp taglist.expected taglist.actual &&
327360
328- echo "in-pack: 7 " > count7.expected &&
361+ echo "in-pack: 4 " > count7.expected &&
329362 GIT_DIR=shallow7/.git git count-objects -v |
330363 grep "^in-pack" > count7.actual &&
331364 test_cmp count7.expected count7.actual
0 commit comments