From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH 2/4] builtin/pack-objects.c: support `--max-pack-size` with `--cruft`
Date: Tue, 29 Aug 2023 13:52:37 -0400 [thread overview]
Message-ID: <ZO4wZdaR/I06n+E8@nand.local> (raw)
In-Reply-To: <xmqqr0nld9u9.fsf@gitster.g>
On Tue, Aug 29, 2023 at 10:42:06AM -0700, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > When pack-objects learned the `--cruft` option back in b757353676
> > (builtin/pack-objects.c: --cruft without expiration, 2022-05-20), we
> > explicitly forbade `--cruft` with `--max-pack-size`.
> >
> > At the time, there was no specific rationale given in the patch for not
> > supporting the `--max-pack-size` option with `--cruft`. (As best I can
> > remember, it's because we were trying to push users towards only ever
> > having a single cruft pack, but I cannot be sure).
>
> I am reasonably sure it was the case but then I do not recall we
> ever discussing how the second cruft pack gets consolidated into one
> by combining it with the existing one.
Yeah. We write the combined cruft pack just like we would any other, and
record each packed object's most recent mtime available from either:
- a loose copy of that object, if one exists
- the mtime of the .pack file for any packed copies of that object
which may exist
- the mtime of that object as recorded in an .mtimes file (if that
file was packed as cruft).
> > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> > index 868efe7e0f..a046994a43 100644
> > --- a/builtin/pack-objects.c
> > +++ b/builtin/pack-objects.c
> > @@ -1190,8 +1190,7 @@ static void write_pack_file(void)
> > unsigned char hash[GIT_MAX_RAWSZ];
> > char *pack_tmp_name = NULL;
> >
> > - if (pack_to_stdout)
> > - f = hashfd_throughput(1, "<stdout>", progress_state);
> > + if (pack_to_stdout) f = hashfd_throughput(1, "<stdout>", progress_state);
> > else
> > f = create_tmp_packfile(&pack_tmp_name);
>
> An unintended change, I am sure ;-)
>
> It is very surprising that absolutely no real change is needed to
> allow cruft packs to honor the settings, other than removing the
> seemingly artificial inter-option-compatibility roadblocks (all
> hunks for it omitted above as they were trivially obvious). I am
> sure the first hunk to fold an "if" statement onto a single line is
> not what makes the feature to actually work ;-)
Hah, this made me laugh. Indeed, a whitespace change around this
if-statement is not the make-or-break change we needed to make this
feature work!
I'm happy to clean this up and resubmit it, but you may have already
done so, in which case I'll leave this as-is.
Thanks,
Taylor
next prev parent reply other threads:[~2023-08-29 17:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 22:48 [PATCH 0/4] pack-objects: support `--max-pack-size` for cruft packs Taylor Blau
2023-08-28 22:49 ` [PATCH 1/4] builtin/pack-objects.c: remove unnecessary strbuf_reset() Taylor Blau
2023-08-29 17:34 ` Junio C Hamano
2023-08-28 22:49 ` [PATCH 2/4] builtin/pack-objects.c: support `--max-pack-size` with `--cruft` Taylor Blau
2023-08-29 17:42 ` Junio C Hamano
2023-08-29 17:52 ` Taylor Blau [this message]
2023-08-28 22:49 ` [PATCH 3/4] Documentation/gitformat-pack.txt: remove multi-cruft packs alternative Taylor Blau
2023-08-28 22:49 ` [PATCH 4/4] Documentation/gitformat-pack.txt: drop mixed version section Taylor Blau
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=ZO4wZdaR/I06n+E8@nand.local \
--to=me@ttaylorr.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).