From: "Tomáš Trnka" <trnka@scm.com>
To: git@vger.kernel.org
Cc: Taylor Blau <me@ttaylorr.com>, Junio C Hamano <gitster@pobox.com>,
Jeff King <peff@peff.net>
Subject: [RFC PATCH resend] builtin/repack: Honor --keep-pack and .keep when repacking promisor objects
Date: Thu, 30 Jan 2025 09:11:31 +0100 [thread overview]
Message-ID: <19759704.fSG56mABFh@electra> (raw)
git-repack currently does not pass --keep-pack or --honor-pack-keep to
the git-pack-objects handling promisor packs. This means that settings
like gc.bigPackThreshold are completely ignored for promisor packs.
The simple fix is to just copy the keep-pack logic into
repack_promisor_objects(), although this could possibly be improved by
making prepare_pack_objects() handle it instead.
Signed-off-by: Tomáš Trnka <trnka@scm.com>
---
RFC: This probably needs a test, but where and how should it be
implemented? Perhaps in t7700-repack.sh, copying one of the tests using
prepare_for_keep_packs and just touching .promisor files? Or instead in
t/t0410-partial-clone.sh using a copy/variant of one of the basic
repack tests there?
builtin/repack.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/builtin/repack.c b/builtin/repack.c
index d6bb37e84a..fe62fe03eb 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -388,15 +388,23 @@ static int has_pack_ext(const struct generated_pack_data *data,
}
static void repack_promisor_objects(const struct pack_objects_args *args,
- struct string_list *names)
+ struct string_list *names,
+ struct string_list *keep_pack_list)
{
struct child_process cmd = CHILD_PROCESS_INIT;
FILE *out;
struct strbuf line = STRBUF_INIT;
+ int i;
prepare_pack_objects(&cmd, args, packtmp);
cmd.in = -1;
+ if (!pack_kept_objects)
+ strvec_push(&cmd.args, "--honor-pack-keep");
+ for (i = 0; i < keep_pack_list->nr; i++)
+ strvec_pushf(&cmd.args, "--keep-pack=%s",
+ keep_pack_list->items[i].string);
+
/*
* NEEDSWORK: Giving pack-objects only the OIDs without any ordering
* hints may result in suboptimal deltas in the resulting pack. See if
@@ -1350,7 +1358,7 @@ int cmd_repack(int argc,
strvec_push(&cmd.args, "--delta-islands");
if (pack_everything & ALL_INTO_ONE) {
- repack_promisor_objects(&po_args, &names);
+ repack_promisor_objects(&po_args, &names, &keep_pack_list);
if (has_existing_non_kept_packs(&existing) &&
delete_redundant &&
base-commit: 92999a42db1c5f43f330e4f2bca4026b5b81576f
--
2.47.1
next reply other threads:[~2025-01-30 8:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 8:11 Tomáš Trnka [this message]
2025-01-30 22:32 ` [RFC PATCH resend] builtin/repack: Honor --keep-pack and .keep when repacking promisor objects Junio C Hamano
2025-01-31 15:17 ` Tomáš Trnka
-- strict thread matches above, loose matches on Subject: below --
2025-01-29 10:02 Tomáš Trnka
2025-01-30 2:26 ` brian m. carlson
2025-01-30 8:09 ` Tomáš Trnka
2025-02-10 11:38 ` [External] " Han Young
2025-02-10 12:52 ` Tomáš Trnka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19759704.fSG56mABFh@electra \
--to=trnka@scm.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).