Merge branch 'jk/dumb-http-finalize'
The dumb-http code regressed when the result of re-indexing a pack yielded an *.idx file that differs in content from the *.idx file it downloaded from the remote. This has been corrected by no longer relying on the *.idx file we got from the remote. * jk/dumb-http-finalize: packfile: use oidread() instead of hashcpy() to fill object_id packfile: use object_id in find_pack_entry_one() packfile: convert find_sha1_pack() to use object_id http-walker: use object_id instead of bare hash packfile: warn people away from parse_packed_git() packfile: drop sha1_pack_index_name() packfile: drop sha1_pack_name() packfile: drop has_pack_index() dumb-http: store downloaded pack idx as tempfile t5550: count fetches in "previously-fetched .idx" test midx: avoid duplicate packed_git entries
This commit is contained in:
@ -307,6 +307,14 @@ test_expect_success 'fetch notices corrupt idx' '
|
||||
)
|
||||
'
|
||||
|
||||
# usage: count_fetches <nr> <extension> <trace_file>
|
||||
count_fetches () {
|
||||
# ignore grep exit code; it may return non-zero if we are expecting no
|
||||
# matches
|
||||
grep "GET .*objects/pack/pack-[a-z0-9]*.$2" "$3" >trace.count
|
||||
test_line_count = "$1" trace.count
|
||||
}
|
||||
|
||||
test_expect_success 'fetch can handle previously-fetched .idx files' '
|
||||
git checkout --orphan branch1 &&
|
||||
echo base >file &&
|
||||
@ -321,8 +329,14 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
|
||||
git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch2 &&
|
||||
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
|
||||
git --bare init clone_packed_branches.git &&
|
||||
git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
|
||||
git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2
|
||||
GIT_TRACE_CURL=$PWD/one.trace git --git-dir=clone_packed_branches.git \
|
||||
fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
|
||||
count_fetches 2 idx one.trace &&
|
||||
count_fetches 1 pack one.trace &&
|
||||
GIT_TRACE_CURL=$PWD/two.trace git --git-dir=clone_packed_branches.git \
|
||||
fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2 &&
|
||||
count_fetches 1 idx two.trace &&
|
||||
count_fetches 1 pack two.trace
|
||||
'
|
||||
|
||||
test_expect_success 'did not use upload-pack service' '
|
||||
@ -507,4 +521,14 @@ test_expect_success 'fetching via http alternates works' '
|
||||
git -c http.followredirects=true clone "$HTTPD_URL/dumb/alt-child.git"
|
||||
'
|
||||
|
||||
test_expect_success 'dumb http can fetch index v1' '
|
||||
server=$HTTPD_DOCUMENT_ROOT_PATH/idx-v1.git &&
|
||||
git init --bare "$server" &&
|
||||
git -C "$server" --work-tree=. commit --allow-empty -m foo &&
|
||||
git -C "$server" -c pack.indexVersion=1 gc &&
|
||||
|
||||
git clone "$HTTPD_URL/dumb/idx-v1.git" &&
|
||||
git -C idx-v1 fsck
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user