Skip to content

Commit 95262af

Browse files
jltoblergitster
authored andcommitted
t5410: test receive-pack connectivity check
As part of git-recieve-pack(1), the connectivity of objects is checked. Add a test validating that git-receive-pack(1) fails due to an incoming packfile that would leave the repository with missing objects. Instead of creating a new test file, "t5410" is generalized for receive-pack testing. Signed-off-by: Justin Tobler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8613c2b commit 95262af

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

t/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ integration_tests = [
629629
't5407-post-rewrite-hook.sh',
630630
't5408-send-pack-stdin.sh',
631631
't5409-colorize-remote-messages.sh',
632-
't5410-receive-pack-alternates.sh',
632+
't5410-receive-pack.sh',
633633
't5411-proc-receive-hook.sh',
634634
't5500-fetch-pack.sh',
635635
't5501-fetch-push-alternates.sh',

t/t5410-receive-pack-alternates.sh renamed to t/t5410-receive-pack.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
test_description='git receive-pack with alternate ref filtering'
3+
test_description='git receive-pack'
44

55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
@@ -41,4 +41,25 @@ test_expect_success 'with core.alternateRefsPrefixes' '
4141
test_cmp expect actual.haves
4242
'
4343

44+
test_expect_success 'receive-pack missing objects fails connectivity check' '
45+
test_when_finished rm -rf repo remote.git setup.git &&
46+
47+
git init repo &&
48+
git -C repo commit --allow-empty -m 1 &&
49+
git clone --bare repo setup.git &&
50+
git -C repo commit --allow-empty -m 2 &&
51+
52+
# Capture git-send-pack(1) output sent to git-receive-pack(1).
53+
git -C repo send-pack ../setup.git --all \
54+
--receive-pack="tee ${SQ}$(pwd)/out${SQ} | git-receive-pack" &&
55+
56+
# Replay captured git-send-pack(1) output on new empty repository.
57+
git init --bare remote.git &&
58+
git receive-pack remote.git <out >actual 2>err &&
59+
60+
test_grep "missing necessary objects" actual &&
61+
test_grep "fatal: Failed to traverse parents" err &&
62+
test_must_fail git -C remote.git cat-file -e $(git -C repo rev-parse HEAD)
63+
'
64+
4465
test_done

0 commit comments

Comments
 (0)