summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 201945e)
raw | patch | inline | side by side (parent: 201945e)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Tue, 5 Feb 2008 14:25:04 +0000 (14:25 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 Feb 2008 07:41:34 +0000 (23:41 -0800) |
"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>
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>
Documentation/config.txt | patch | blob | history | |
Documentation/git-pack-objects.txt | patch | blob | history | |
builtin-pack-objects.c | patch | blob | history | |
t/t5300-pack-object.sh | patch | blob | history |
index 4e222f15a5b2b84eb5d55bc79c605510bd89b7b6..3e10feb9fbbf44c634c32f30dd23a4534535190d 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
whenever the corresponding pack is larger than 2 GB. Otherwise
the default is 1.
+pack.packSizeLimit:
+ The default maximum size of a pack. This setting only affects
+ packing to a file, i.e. the git:// protocol is unaffected. It
+ can be overridden by the `\--max-pack-size` option of
+ linkgit:git-repack[1].
+
pull.octopus::
The default merge strategy to use when pulling multiple branches
at once.
index 74cc7c1cb831c700c14406f6e306e7a3002054d2..8353be186fcc83092acac16b4fc164d6ea669621 100644 (file)
--max-pack-size=<n>::
Maximum size of each output packfile, expressed in MiB.
If specified, multiple packfiles may be created.
- The default is unlimited.
+ The default is unlimited, unless the config variable
+ `pack.packSizeLimit` is set.
--incremental::
This flag causes an object already in a pack ignored
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index d3efeff03f89cc0f4d0da463ddf878c28effb31e..692a76126b027133fd046f03003fe8e49218f192 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
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;
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);
}
}
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);
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.");
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 4f350dd4ec3658357a7e69f54fb64709a22a2bc9..cd3c149800395553cc973317ef41e89e53771f60 100755 (executable)
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
'make sure index-pack detects the SHA1 collision' \
'! git-index-pack -o bad.idx test-3.pack'
+test_expect_success \
+ 'honor pack.packSizeLimit' \
+ 'git config pack.packSizeLimit 200 &&
+ packname_4=$(git pack-objects test-4 <obj-list) &&
+ test 3 = $(ls test-4-*.pack | wc -l)'
+
test_done