]> git.ipfire.org Git - thirdparty/git.git/commit - revision.h
revision: learn '--no-kept-objects'
authorTaylor Blau <me@ttaylorr.com>
Tue, 23 Feb 2021 02:25:07 +0000 (21:25 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Feb 2021 07:30:52 +0000 (23:30 -0800)
commitc9fff0001699dd2862bf350146631fe53c1226d9
tree5596f7944bbaf37f9b7726c70ef4e6c7195de743
parentf62312e02837d91e3b47ea876654bf3ac97b2905
revision: learn '--no-kept-objects'

A future caller will want to be able to perform a reachability traversal
which terminates when visiting an object found in a kept pack. The
closest existing option is '--honor-pack-keep', but this isn't quite
what we want. Instead of halting the traversal midway through, a full
traversal is always performed, and the results are only trimmed
afterwords.

Besides needing to introduce a new flag (since culling results
post-facto can be different than halting the traversal as it's
happening), there is an additional wrinkle handling the distinction
in-core and on-disk kept packs. That is: what kinds of kept pack should
stop the traversal?

Introduce '--no-kept-objects[=<on-disk|in-core>]' to specify which kinds
of kept packs, if any, should stop a traversal. This can be useful for
callers that want to perform a reachability analysis, but want to leave
certain packs alone (for e.g., when doing a geometric repack that has
some "large" packs which are kept in-core that it wants to leave alone).

Note that this option is not guaranteed to produce exactly the set of
objects that aren't in kept packs, since it's possible the traversal
order may end up in a situation where a non-kept ancestor was "cut off"
by a kept object (at which point we would stop traversing). But, we
don't care about absolute correctness here, since this will eventually
be used as a purely additive guide in an upcoming new repack mode.

Explicitly avoid documenting this new flag, since it is only used
internally. In theory we could avoid even adding it rev-list, but being
able to spell this option out on the command-line makes some special
cases easier to test without promising to keep it behaving consistently
forever. Those tricky cases are exercised in t6114.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
revision.h
t/t6114-keep-packs.sh [new file with mode: 0755]