Re: [PATCH 7/8] git-repack --max-pack-size: split packs as asked by write_object/write_one
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- May 1, 2007, 05:40 UTC
- Message-ID
- <20070501054034.GB5942@spearce.org>
- In-Reply-To
- <46367AA1.8080009@gmail.com>
Dana How <danahow@gmail.com> wrote:
Show 5 quoted lines
> 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
...
> @@ -672,74 +673,94 @@ static int adjust_perm(const char *path, mode_t mode);
...
> + 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.
-- Shawn.