From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] builtin/repack: fix `--keep-unreachable` when there are no packs
Date: Tue, 4 Feb 2025 08:01:01 +0100 [thread overview]
Message-ID: <Z6G7LTVqw3l-b7lN@pks.im> (raw)
In-Reply-To: <20250204030157.GC23954@coredump.intra.peff.net>
On Mon, Feb 03, 2025 at 10:01:57PM -0500, Jeff King wrote:
> On Mon, Feb 03, 2025 at 02:06:55PM +0100, Patrick Steinhardt wrote:
> > Fix the bug by splitting out the "--pack-loose-unreachable" and only
> > making it depend on the second and third condition. Like this, loose
> > unreachable objects will be packed regardless of any preexisting
> > packfiles.
>
> Makes sense. My only question would be whether there are any gotchas
> inside pack-objects about using --pack-loose-unreachable without
> --keep-unreachable (since the two were up until now always used
> together).
>
> It was added by e26a8c4721. And looking over that patch, I don't see
> anything that would let the options be used independently. So this seems
> like a good solution.
You probably meant "I don't see anything that would *not* let the
options be used independently." But yeah, they don't seem to require one
another.
> > diff --git a/builtin/repack.c b/builtin/repack.c
> > index 81d13630ea..8194344b04 100644
> > --- a/builtin/repack.c
> > +++ b/builtin/repack.c
> > @@ -1370,9 +1370,12 @@ int cmd_repack(int argc,
> > "--unpack-unreachable");
> > } else if (keep_unreachable) {
> > strvec_push(&cmd.args, "--keep-unreachable");
> > - strvec_push(&cmd.args, "--pack-loose-unreachable");
> > }
> > }
> > +
> > + if (keep_unreachable && delete_redundant &&
> > + !(pack_everything & PACK_CRUFT))
> > + strvec_push(&cmd.args, "--pack-loose-unreachable");
>
> One funny thing here is that previously unpack_unreachable took
> precedence over keep_unreachable in the if-else chain. I wondered if we
> could end up invoking pack-objects with both --unpack-unreachable and
> --pack-loose-unreachable, which is nonsense.
>
> But I think the answer is no, because we forbid --unpack-unreachable/-A
> and --keep-unreachable from both being passed up front.
Yup.
> > -test_expect_failure '--keep-unreachable packs unreachable loose object without existing packs' '
> > +test_expect_success '--keep-unreachable packs unreachable loose object without existing packs' '
> > test_when_finished "rm -rf repo" &&
> > git init repo &&
> > (
>
> Your test from patch 1 looked reasonable to me. If you fold patch 1 into
> the existing tests in t7701, you might want to adjust it to match the
> techniques those tests use for checking the object (rather than the new
> helpers you added).
Will do.
Thanks!
Patrick
next prev parent reply other threads:[~2025-02-04 7:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 13:06 [PATCH 0/2] builtin/repack: fix `--keep-unreachable` when there are no packs Patrick Steinhardt
2025-02-03 13:06 ` [PATCH 1/2] t7700: add tests for `--keep-unreachable` Patrick Steinhardt
2025-02-03 17:13 ` Junio C Hamano
2025-02-03 18:32 ` Jeff King
2025-02-03 23:53 ` Junio C Hamano
2025-02-04 2:35 ` Jeff King
2025-02-04 7:00 ` Patrick Steinhardt
2025-02-03 13:06 ` [PATCH 2/2] builtin/repack: fix `--keep-unreachable` when there are no packs Patrick Steinhardt
2025-02-04 3:01 ` Jeff King
2025-02-04 7:01 ` Patrick Steinhardt [this message]
2025-02-04 14:58 ` Jeff King
2025-02-04 13:28 ` Junio C Hamano
2025-02-04 7:00 ` [PATCH v2] " Patrick Steinhardt
2025-02-04 15:22 ` Jeff King
2025-02-05 5:36 ` Patrick Steinhardt
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=Z6G7LTVqw3l-b7lN@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--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).