]> git.ipfire.org Git - thirdparty/git.git/commit
clone: fail gracefully when cloning filtered bundle
authorDerrick Stolee <derrickstolee@github.com>
Wed, 9 Mar 2022 16:01:43 +0000 (16:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Mar 2022 18:25:28 +0000 (10:25 -0800)
commit86fdd94d723b7fa1870a64e8080d3540a434f29b
treea35cc14364ff9f9576f7ce12ff1a46dfcd0e591d
parent4f39eb031af8690eb86eb781e43b10141dd47da9
clone: fail gracefully when cloning filtered bundle

Users can create a new repository using 'git clone <bundle-file>'. The
new "@filter" capability for bundles means that we can generate a bundle
that does not contain all reachable objects, even if the header has no
negative commit OIDs.

It is feasible to think that we could make a filtered bundle work with
the command

  git clone --filter=$filter --bare <bundle-file>

or possibly replacing --bare with --no-checkout. However, this requires
having some repository-global config that specifies the specified object
filter and notifies Git about the existence of promisor pack-files.
Without a remote, that is currently impossible.

As a stop-gap, parse the bundle header during 'git clone' and die() with
a helpful error message instead of the current behavior of failing due
to "missing objects".

Most of the existing logic for handling bundle clones actually happens
in fetch-pack.c, but that logic is the same as if the user specified
'git fetch <bundle>', so we want to avoid failing to fetch a filtered
bundle when in an existing repository that has the proper config set up
for at least one remote.

Carefully comment around the test that this is not the desired long-term
behavior of 'git clone' in this case, but instead that we need to do
more work before that is possible.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
t/t6020-bundle-misc.sh