git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/8] git-repack --max-pack-size: split packs as asked by write_object/write_one

From
DHDana How <danahow@gmail.com>
Date
May 1, 2007, 06:05 UTC
Message-ID
<56b7f5510704302305s5cf0d0cbg52906e400bcc4a22@mail.gmail.com>
In-Reply-To
<20070501054034.GB5942@spearce.org>
On 4/30/07, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 18 quoted lines
> Dana How <danahow@gmail.com> wrote:
> > Rewrite write_pack_file() to break to a new packfile
> > whenever write_object/write_one request it,  and
> > correct the header's object count in the previous packfile.
> > Change write_index_file() to write an index
> > for just the objects in the most recent packfile.
> ...
> > diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> ...
> > +             hdr.hdr_signature = htonl(PACK_SIGNATURE);
> > +             hdr.hdr_version = htonl(PACK_VERSION);
> > +             hdr.hdr_entries = htonl(nr_result);
>
> What about keeping track of how many objects in nr_result that
> have been written already in the prior iteration of this do{}
> while loop and using that to set hdr_entries?  This way if you are
> splitting into multiple packfiles the last packfile won't need to
> do a header/footer fixup.

Cool -- I had the same thought (late), but figured I would address it in a follow-on. I was thinking of adding nr_left, which would be initialized from nr_result, and have nr_written repeatedly subtracted. nr_result in your quote would change to nr_left (also later, where we decide whether or not to fix up the header).

Thanks,
-- 
Dana L. How  danahow@gmail.com  +1 650 804 5991 cell
Previous: Shawn O. Pearce
Message 3 of 3 in “git-repack --max-pack-size: split packs as asked by write_object/write_one”
  1. 7/8 git-repack --max-pack-size: split packs as asked by write_object/write_oneDana How, Apr 30, 2007
  2. Shawn O. PearceMay 1, 2007
  3. Dana HowMay 1, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.