diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-05 10:44:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-05 20:25:49 -0700 |
commit | 15366280c27e922ace0ba7d33cb3504dc59d742e (patch) | |
tree | fe512d5fabebbb2257b818e9cd3a530eb163e599 | |
parent | 7ed863a85a6ce2c4ac4476848310b8f917ab41f9 (diff) | |
download | git-15366280c27e922ace0ba7d33cb3504dc59d742e.tar.gz |
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>
-rw-r--r-- | Documentation/config.txt | 2 | ||||
-rw-r--r-- | builtin/pack-objects.c | 8 | ||||
-rw-r--r-- | cache.h | 1 | ||||
-rw-r--r-- | config.c | 6 | ||||
-rw-r--r-- | environment.c | 1 | ||||
-rw-r--r-- | fast-import.c | 5 |
6 files changed, 14 insertions, 9 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index c5e183516a..c5598f4af9 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -451,8 +451,6 @@ for most projects as source code and other text files can still be delta compressed, but larger binary media files won't be. + Common unit suffixes of 'k', 'm', or 'g' are supported. -+ -Currently only linkgit:git-fast-import[1] honors this setting. core.excludesfile:: In addition to '.gitignore' (per-directory) and diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index b0503b202a..f402a843bb 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1142,8 +1142,12 @@ static void get_object_details(void) sorted_by_offset[i] = objects + i; qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort); - for (i = 0; i < nr_objects; i++) - check_object(sorted_by_offset[i]); + for (i = 0; i < nr_objects; i++) { + struct object_entry *entry = sorted_by_offset[i]; + check_object(entry); + if (big_file_threshold <= entry->size) + entry->no_try_delta = 1; + } free(sorted_by_offset); } @@ -555,6 +555,7 @@ extern int core_compression_seen; extern size_t packed_git_window_size; extern size_t packed_git_limit; extern size_t delta_base_cache_limit; +extern unsigned long big_file_threshold; extern int read_replace_refs; extern int fsync_object_files; extern int core_preload_index; @@ -567,6 +567,12 @@ static int git_default_core_config(const char *var, const char *value) return 0; } + if (!strcmp(var, "core.bigfilethreshold")) { + long n = git_config_int(var, value); + big_file_threshold = 0 < n ? n : 0; + return 0; + } + if (!strcmp(var, "core.packedgitlimit")) { packed_git_limit = git_config_int(var, value); return 0; diff --git a/environment.c b/environment.c index 9564475f42..8557e84ff6 100644 --- a/environment.c +++ b/environment.c @@ -35,6 +35,7 @@ int fsync_object_files; size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE; size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT; size_t delta_base_cache_limit = 16 * 1024 * 1024; +unsigned long big_file_threshold = 512 * 1024 * 1024; const char *pager_program; int pager_use_color = 1; const char *editor_program; diff --git a/fast-import.c b/fast-import.c index 60f26fe473..1421dcd6eb 100644 --- a/fast-import.c +++ b/fast-import.c @@ -284,7 +284,6 @@ struct recent_command /* Configured limits on output */ static unsigned long max_depth = 10; static off_t max_packsize; -static uintmax_t big_file_threshold = 512 * 1024 * 1024; static int force_update; static int pack_compression_level = Z_DEFAULT_COMPRESSION; static int pack_compression_seen; @@ -3053,10 +3052,6 @@ static int git_pack_config(const char *k, const char *v, void *cb) max_packsize = git_config_ulong(k, v); return 0; } - if (!strcmp(k, "core.bigfilethreshold")) { - long n = git_config_int(k, v); - big_file_threshold = 0 < n ? n : 0; - } return git_default_config(k, v, cb); } |