Skip to content

Commit f28d2e3

Browse files
committed
Merge branch 'jc/pack-objects-bigfile' into maint
* jc/pack-objects-bigfile: Teach core.bigfilethreashold to pack-objects
2 parents f6bfe76 + 1536628 commit f28d2e3

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

Documentation/config.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ for most projects as source code and other text files can still
442442
be delta compressed, but larger binary media files won't be.
443443
+
444444
Common unit suffixes of 'k', 'm', or 'g' are supported.
445-
+
446-
Currently only linkgit:git-fast-import[1] honors this setting.
447445

448446
core.excludesfile::
449447
In addition to '.gitignore' (per-directory) and

builtin/pack-objects.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,12 @@ static void get_object_details(void)
11421142
sorted_by_offset[i] = objects + i;
11431143
qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort);
11441144

1145-
for (i = 0; i < nr_objects; i++)
1146-
check_object(sorted_by_offset[i]);
1145+
for (i = 0; i < nr_objects; i++) {
1146+
struct object_entry *entry = sorted_by_offset[i];
1147+
check_object(entry);
1148+
if (big_file_threshold <= entry->size)
1149+
entry->no_try_delta = 1;
1150+
}
11471151

11481152
free(sorted_by_offset);
11491153
}

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ extern int core_compression_seen;
573573
extern size_t packed_git_window_size;
574574
extern size_t packed_git_limit;
575575
extern size_t delta_base_cache_limit;
576+
extern unsigned long big_file_threshold;
576577
extern int read_replace_refs;
577578
extern int fsync_object_files;
578579
extern int core_preload_index;

config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,12 @@ static int git_default_core_config(const char *var, const char *value)
567567
return 0;
568568
}
569569

570+
if (!strcmp(var, "core.bigfilethreshold")) {
571+
long n = git_config_int(var, value);
572+
big_file_threshold = 0 < n ? n : 0;
573+
return 0;
574+
}
575+
570576
if (!strcmp(var, "core.packedgitlimit")) {
571577
packed_git_limit = git_config_int(var, value);
572578
return 0;

environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ int fsync_object_files;
3535
size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
3636
size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
3737
size_t delta_base_cache_limit = 16 * 1024 * 1024;
38+
unsigned long big_file_threshold = 512 * 1024 * 1024;
3839
const char *pager_program;
3940
int pager_use_color = 1;
4041
const char *editor_program;

fast-import.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ struct recent_command {
274274
/* Configured limits on output */
275275
static unsigned long max_depth = 10;
276276
static off_t max_packsize;
277-
static uintmax_t big_file_threshold = 512 * 1024 * 1024;
278277
static int force_update;
279278
static int pack_compression_level = Z_DEFAULT_COMPRESSION;
280279
static int pack_compression_seen;
@@ -3206,10 +3205,6 @@ static int git_pack_config(const char *k, const char *v, void *cb)
32063205
max_packsize = git_config_ulong(k, v);
32073206
return 0;
32083207
}
3209-
if (!strcmp(k, "core.bigfilethreshold")) {
3210-
long n = git_config_int(k, v);
3211-
big_file_threshold = 0 < n ? n : 0;
3212-
}
32133208
return git_default_config(k, v, cb);
32143209
}
32153210

0 commit comments

Comments
 (0)