summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2008-02-05 14:25:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-10 07:41:34 (GMT)
commit2b84b5a874d3281d15aa0b73426b13597cd02520 (patch)
tree8149c482fc0bfcc69eb1f065b2f989ba7ff30742 /builtin-pack-objects.c
parent201945eeb3b52400e16bb36bf60c56a849c62f32 (diff)
downloadgit-2b84b5a874d3281d15aa0b73426b13597cd02520.zip
git-2b84b5a874d3281d15aa0b73426b13597cd02520.tar.gz
git-2b84b5a874d3281d15aa0b73426b13597cd02520.tar.bz2
Introduce the config variable pack.packSizeLimit
"git pack-objects" has the option --max-pack-size to limit the file size of the packs to a certain amount of bytes. On platforms where the pack file size is limited by filesystem constraints, it is easy to forget this option, and this option does not exist for "git gc" to begin with. So introduce a config variable to set the default maximum, but make this overrideable by the command line. Suggested by Tor Arvid Lund. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index d3efeff..692a761 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -68,7 +68,7 @@ static int allow_ofs_delta;
static const char *base_name;
static int progress = 1;
static int window = 10;
-static uint32_t pack_size_limit;
+static uint32_t pack_size_limit, pack_size_limit_cfg;
static int depth = 50;
static int delta_search_threads = 1;
static int pack_to_stdout;
@@ -1867,6 +1867,10 @@ static int git_pack_config(const char *k, const char *v)
die("bad pack.indexversion=%d", pack_idx_default_version);
return 0;
}
+ if (!strcmp(k, "pack.packsizelimit")) {
+ pack_size_limit_cfg = git_config_ulong(k, v);
+ return 0;
+ }
return git_default_config(k, v);
}
@@ -2096,6 +2100,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
}
if (!prefixcmp(arg, "--max-pack-size=")) {
char *end;
+ pack_size_limit_cfg = 0;
pack_size_limit = strtoul(arg+16, &end, 0) * 1024 * 1024;
if (!arg[16] || *end)
usage(pack_usage);
@@ -2220,6 +2225,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (pack_to_stdout != !base_name)
usage(pack_usage);
+ if (!pack_to_stdout && !pack_size_limit)
+ pack_size_limit = pack_size_limit_cfg;
+
if (pack_to_stdout && pack_size_limit)
die("--max-pack-size cannot be used to build a pack for transfer.");