Skip to content

Commit f21d2a7

Browse files
matthijskooijmangitster
authored andcommitted
Add testcase for needless objects during a shallow fetch
This is a testcase that checks for a problem where, during a specific shallow fetch where the client does not have any commits that are a successor of the new shallow root (i.e., the fetch creates a new detached piece of history), the server would simply send over _all_ objects, instead of taking into account the objects already present in the client. The actual problem was fixed by a recent patch series by Nguyễn Thái Ngọc Duy already. Signed-off-by: Matthijs Kooijman <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fbd4a70 commit f21d2a7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t5500-fetch-pack.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,17 @@ test_expect_success 'fetch in shallow repo unreachable shallow objects' '
393393
git fsck --no-dangling
394394
)
395395
'
396+
test_expect_success 'fetch creating new shallow root' '
397+
(
398+
git clone "file://$(pwd)/." shallow10 &&
399+
git commit --allow-empty -m empty &&
400+
cd shallow10 &&
401+
git fetch --depth=1 --progress 2>actual &&
402+
# This should fetch only the empty commit, no tree or
403+
# blob objects
404+
grep "remote: Total 1" actual
405+
)
406+
'
396407

397408
test_expect_success 'setup tests for the --stdin parameter' '
398409
for head in C D E F

0 commit comments

Comments
 (0)