Skip to content

Commit 89e0a3a

Browse files
npitregitster
authored andcommitted
fast-import: make default pack size unlimited
Now that fast-import is creating packs with index version 2, there is no point limiting the pack size by default. A pack split will still happen if off_t is not sufficiently large to hold large offsets. While updating the doc, let's remove the "packfiles fit on CDs" suggestion. Pack files created by fast-import are still suboptimal and a 'git repack -a -f -d' or even 'git gc --aggressive' would be a pretty good idea before considering storage on CDs. Signed-off-by: Nicolas Pitre <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 427cb22 commit 89e0a3a

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Documentation/git-fast-import.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ OPTIONS
4545

4646
--max-pack-size=<n>::
4747
Maximum size of each output packfile.
48-
The default is 4 GiB as that is the maximum allowed
49-
packfile size (due to file format limitations). Some
50-
importers may wish to lower this, such as to ensure the
51-
resulting packfiles fit on CDs.
48+
The default is unlimited.
5249

5350
--big-file-threshold=<n>::
5451
Maximum size of a blob that fast-import will attempt to

fast-import.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ struct mark_set
191191
struct last_object
192192
{
193193
struct strbuf data;
194-
uint32_t offset;
194+
off_t offset;
195195
unsigned int depth;
196196
unsigned no_swap : 1;
197197
};
@@ -279,7 +279,7 @@ struct recent_command
279279

280280
/* Configured limits on output */
281281
static unsigned long max_depth = 10;
282-
static off_t max_packsize = (1LL << 32) - 1;
282+
static off_t max_packsize;
283283
static uintmax_t big_file_threshold = 512 * 1024 * 1024;
284284
static int force_update;
285285
static int pack_compression_level = Z_DEFAULT_COMPRESSION;
@@ -315,7 +315,7 @@ static unsigned int pack_id;
315315
static struct sha1file *pack_file;
316316
static struct packed_git *pack_data;
317317
static struct packed_git **all_packs;
318-
static unsigned long pack_size;
318+
static off_t pack_size;
319319

320320
/* Table of objects we've written. */
321321
static unsigned int object_entry_alloc = 5000;
@@ -1068,7 +1068,7 @@ static int store_object(
10681068
deflateEnd(&s);
10691069

10701070
/* Determine if we should auto-checkpoint. */
1071-
if ((pack_size + 60 + s.total_out) > max_packsize
1071+
if ((max_packsize && (pack_size + 60 + s.total_out) > max_packsize)
10721072
|| (pack_size + 60 + s.total_out) < pack_size) {
10731073

10741074
/* This new object needs to *not* have the current pack_id. */
@@ -1101,7 +1101,7 @@ static int store_object(
11011101
crc32_begin(pack_file);
11021102

11031103
if (delta) {
1104-
unsigned long ofs = e->idx.offset - last->offset;
1104+
off_t ofs = e->idx.offset - last->offset;
11051105
unsigned pos = sizeof(hdr) - 1;
11061106

11071107
delta_count_by_type[type]++;
@@ -1170,7 +1170,7 @@ static void stream_blob(uintmax_t len, unsigned char *sha1out, uintmax_t mark)
11701170
int status = Z_OK;
11711171

11721172
/* Determine if we should auto-checkpoint. */
1173-
if ((pack_size + 60 + len) > max_packsize
1173+
if ((max_packsize && (pack_size + 60 + len) > max_packsize)
11741174
|| (pack_size + 60 + len) < pack_size)
11751175
cycle_packfile();
11761176

0 commit comments

Comments
 (0)