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 <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicolas Pitre committed
Feb 17, 2010 at 14:05 UTC
89e0a3a131d251b5345845529d5258ab91105c9b
2 files changed
+7
-10
Documentation/git-fast-import.txt
+1
-4
@@ -45,10 +45,7 @@ OPTIONS
45
46
--max-pack-size=<n>::
47
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.
49
50
--big-file-threshold=<n>::
51
Maximum size of a blob that fast-import will attempt to
fast-import.c
+6
-6
@@ -191,7 +191,7 @@ struct mark_set
191
struct last_object
192
{
193
struct strbuf data;
194
- uint32_t offset;
194
+ off_t offset;
195
unsigned int depth;
196
unsigned no_swap : 1;
197
};
@@ -279,7 +279,7 @@ struct recent_command
279
280
/* Configured limits on output */
281
static unsigned long max_depth = 10;
282
-static off_t max_packsize = (1LL << 32) - 1;
282
+static off_t max_packsize;
283
static uintmax_t big_file_threshold = 512 * 1024 * 1024;
284
static int force_update;
285
static int pack_compression_level = Z_DEFAULT_COMPRESSION;
@@ -315,7 +315,7 @@ static unsigned int pack_id;
315
static struct sha1file *pack_file;
316
static struct packed_git *pack_data;
317
static struct packed_git **all_packs;
318
-static unsigned long pack_size;
318
+static off_t pack_size;
319
320
/* Table of objects we've written. */
321
static unsigned int object_entry_alloc = 5000;
@@ -1068,7 +1068,7 @@ static int store_object(
1068
deflateEnd(&s);
1069
1070
/* 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)
1072
|| (pack_size + 60 + s.total_out) < pack_size) {
1073
1074
/* This new object needs to *not* have the current pack_id. */
@@ -1101,7 +1101,7 @@ static int store_object(
1101
crc32_begin(pack_file);
1102
1103
if (delta) {
1104
- unsigned long ofs = e->idx.offset - last->offset;
1104
+ off_t ofs = e->idx.offset - last->offset;
1105
unsigned pos = sizeof(hdr) - 1;
1106
1107
delta_count_by_type[type]++;
@@ -1170,7 +1170,7 @@ static void stream_blob(uintmax_t len, unsigned char *sha1out, uintmax_t mark)
1170
int status = Z_OK;
1171
1172
/* Determine if we should auto-checkpoint. */
1173
- if ((pack_size + 60 + len) > max_packsize
1173
+ if ((max_packsize && (pack_size + 60 + len) > max_packsize)
1174
|| (pack_size + 60 + len) < pack_size)
1175
cycle_packfile();
1176