Skip to content

Commit 117c1b3

Browse files
committed
Merge branch 'jk/dumb-http-idx-fetch-fix' into maint
A broken pack .idx file in the receiving repository prevented the dumb http transport from fetching a good copy of it from the other side. * jk/dumb-http-idx-fetch-fix: dumb-http: do not pass NULL path to parse_pack_index
2 parents 9f8410b + 8b9c2dd commit 117c1b3

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head,
12501250
int ret;
12511251

12521252
if (has_pack_index(sha1)) {
1253-
new_pack = parse_pack_index(sha1, NULL);
1253+
new_pack = parse_pack_index(sha1, sha1_pack_index_name(sha1));
12541254
if (!new_pack)
12551255
return -1; /* parse_pack_index() already issued error message */
12561256
goto add_pack;

t/t5550-http-fetch-dumb.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,24 @@ test_expect_success 'fetch notices corrupt idx' '
165165
)
166166
'
167167

168+
test_expect_success 'fetch can handle previously-fetched .idx files' '
169+
git checkout --orphan branch1 &&
170+
echo base >file &&
171+
git add file &&
172+
git commit -m base &&
173+
git --bare init "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git &&
174+
git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch1 &&
175+
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
176+
git checkout -b branch2 branch1 &&
177+
echo b2 >>file &&
178+
git commit -a -m b2 &&
179+
git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch2 &&
180+
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
181+
git --bare init clone_packed_branches.git &&
182+
git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
183+
git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2
184+
'
185+
168186
test_expect_success 'did not use upload-pack service' '
169187
grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
170188
: >exp

0 commit comments

Comments
 (0)