@matheusbsbs / matheus-bagliano / commits / 15366280c2
Fork 0

Teach core.bigfilethreashold to pack-objects

The pack-objects command should take notice of the object file and refrain from attempting to delta large ones, to be consistent with the fast-import command. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 5, 2011 at 10:44 UTC 15366280c27e922ace0ba7d33cb3504dc59d742e
6 files changed +14 -9
Documentation/config.txt
-2
@@ -451,8 +451,6 @@ for most projects as source code and other text files can still
451 be delta compressed, but larger binary media files won't be.
452 +
453 Common unit suffixes of 'k', 'm', or 'g' are supported.
454 -+
455 -Currently only linkgit:git-fast-import[1] honors this setting.
454
455 core.excludesfile::
456 In addition to '.gitignore' (per-directory) and
builtin/pack-objects.c
+6 -2
@@ -1142,8 +1142,12 @@ static void get_object_details(void)
1142 sorted_by_offset[i] = objects + i;
1143 qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort);
1144
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 + }
1151
1152 free(sorted_by_offset);
1153 }
cache.h
+1
@@ -555,6 +555,7 @@ extern int core_compression_seen;
555 extern size_t packed_git_window_size;
556 extern size_t packed_git_limit;
557 extern size_t delta_base_cache_limit;
558 +extern unsigned long big_file_threshold;
559 extern int read_replace_refs;
560 extern int fsync_object_files;
561 extern int core_preload_index;
config.c
+6
@@ -567,6 +567,12 @@ static int git_default_core_config(const char *var, const char *value)
567 return 0;
568 }
569
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 +
576 if (!strcmp(var, "core.packedgitlimit")) {
577 packed_git_limit = git_config_int(var, value);
578 return 0;
environment.c
+1
@@ -35,6 +35,7 @@ int fsync_object_files;
35 size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
36 size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
37 size_t delta_base_cache_limit = 16 * 1024 * 1024;
38 +unsigned long big_file_threshold = 512 * 1024 * 1024;
39 const char *pager_program;
40 int pager_use_color = 1;
41 const char *editor_program;
fast-import.c
-5
@@ -284,7 +284,6 @@ struct recent_command
284 /* Configured limits on output */
285 static unsigned long max_depth = 10;
286 static off_t max_packsize;
287 -static uintmax_t big_file_threshold = 512 * 1024 * 1024;
287 static int force_update;
288 static int pack_compression_level = Z_DEFAULT_COMPRESSION;
289 static int pack_compression_seen;
@@ -3053,10 +3052,6 @@ static int git_pack_config(const char *k, const char *v, void *cb)
3052 max_packsize = git_config_ulong(k, v);
3053 return 0;
3054 }
3056 - if (!strcmp(k, "core.bigfilethreshold")) {
3057 - long n = git_config_int(k, v);
3058 - big_file_threshold = 0 < n ? n : 0;
3059 - }
3055 return git_default_config(k, v, cb);
3056 }
3057