]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/pack-objects: exclude promisor objects with "--stdin-packs"
authorPatrick Steinhardt <ps@pks.im>
Mon, 5 Jan 2026 13:16:41 +0000 (14:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Jan 2026 14:29:24 +0000 (06:29 -0800)
commit0cd306ebc8c7a9faeced0a2fa7bddeea434bf285
treedcd442ca6aa100bffcb19888aba8199d7882590b
parent8745eae506f700657882b9e32b2aa00f234a6fb6
builtin/pack-objects: exclude promisor objects with "--stdin-packs"

It is currently not possible to combine "--exclude-promisor-objects"
with "--stdin-packs" because both flags want to set up a revision walk
to enumerate the objects to pack. In a subsequent commit though we want
to extend geometric repacks to support promisor objects, and for that we
need to handle the combination of both flags.

There are two cases we have to think about here:

  - "--stdin-packs" asks us to pack exactly the objects part of the
    specified packfiles. It is somewhat questionable what to do in the
    case where the user asks us to exclude promisor objects, but at the
    same time explicitly passes a promisor pack to us. For now, we
    simply abort the request as it is self-contradicting. As we have
    also been dying before this commit there is no regression here.

  - "--stdin-packs=follow" does the same as the first flag, but it also
    asks us to include all objects transitively reachable from any
    object in the packs we are about to repack. This is done by doing
    the revision walk mentioned further up. Luckily, fixing this case is
    trivial: we only need to modify the revision walk to also set the
    `exclude_promisor_objects` field.

Note that we do not support the "--exclude-promisor-objects-best-effort"
flag for now as we don't need it to support geometric repacking with
promisor objects.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
t/t5331-pack-objects-stdin.sh