diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-03-04 17:16:20 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-05 15:04:09 -0800 |
commit | 2aec3bc4b64ae4980dda86ed77f372a1f66acc7f (patch) | |
tree | 26c37d64c977b840a9a31dddffe4a0070ddb3d6c /Documentation/howto | |
parent | fetch-pack: print and use dangling .gitmodules (diff) | |
download | tgif-2aec3bc4b64ae4980dda86ed77f372a1f66acc7f.tar.xz |
fetch-pack: do not mix --pack_header and packfile uri
When fetching (as opposed to cloning) from a repository with packfile
URIs enabled, an error like this may occur:
fatal: pack has bad object at offset 12: unknown object type 5
fatal: finish_http_pack_request gave result -1
fatal: fetch-pack: expected keep then TAB at start of http-fetch output
This bug was introduced in b664e9ffa1 ("fetch-pack: with packfile URIs,
use index-pack arg", 2021-02-22), when the index-pack args used when
processing the inline packfile of a fetch response and when processing
packfile URIs were unified.
This bug happens because fetch, by default, partially reads (and
consumes) the header of the inline packfile to determine if it should
store the downloaded objects as a packfile or loose objects, and thus
passes --pack_header=<...> to index-pack to inform it that some bytes
are missing. However, when it subsequently fetches the additional
packfiles linked by URIs, it reuses the same index-pack arguments, thus
wrongly passing --index-pack-arg=--pack_header=<...> when no bytes are
missing.
This does not happen when cloning because "git clone" always passes
do_keep, which instructs the fetch mechanism to always retain the
packfile, eliminating the need to read the header.
There are a few ways to fix this, including filtering out pack_header
arguments when downloading the additional packfiles, but I decided to
stick to always using index-pack throughout when packfile URIs are
present - thus, Git no longer needs to read the bytes, and no longer
needs --pack_header here.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/howto')
0 files changed, 0 insertions, 0 deletions