pack-objects: check pack.window for default window size
For some repositories, deltas simply don't make sense. One can disable them for git-repack by adding --window, but git-push insists on making the deltas which can be very CPU-intensive for little benefit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jeff King committed
Jul 23, 2006 at 01:50 UTC
4812a93a8c0ad25ee701da8ff46a3c5d62994224
2 files changed
+16
-1
Documentation/config.txt
+4
@@ -193,6 +193,10 @@ merge.summary::
193
Whether to include summaries of merged commits in newly created
194
merge commit messages. False by default.
195
196
+pack.window::
197
+ The size of the window used by gitlink:git-pack-objects[1] when no
198
+ window size is given on the command line. Defaults to 10.
199
+
200
pull.octopus::
201
The default merge strategy to use when pulling multiple branches
202
at once.
pack-objects.c
+12
-1
@@ -63,6 +63,7 @@ static const char *base_name;
63
static unsigned char pack_file_sha1[20];
64
static int progress = 1;
65
static volatile sig_atomic_t progress_update = 0;
66
+static int window = 10;
67
68
/*
69
* The object names in objects array are hashed with this hashtable,
@@ -1216,16 +1217,26 @@ static void setup_progress_signal(void)
1217
setitimer(ITIMER_REAL, &v, NULL);
1218
}
1219
1220
+static int git_pack_config(const char *k, const char *v)
1221
+{
1222
+ if(!strcmp(k, "pack.window")) {
1223
+ window = git_config_int(k, v);
1224
+ return 0;
1225
+ }
1226
+ return git_default_config(k, v);
1227
+}
1228
+
1229
int main(int argc, char **argv)
1230
{
1231
SHA_CTX ctx;
1232
char line[40 + 1 + PATH_MAX + 2];
1223
- int window = 10, depth = 10, pack_to_stdout = 0;
1233
+ int depth = 10, pack_to_stdout = 0;
1234
struct object_entry **list;
1235
int num_preferred_base = 0;
1236
int i;
1237
1238
setup_git_directory();
1239
+ git_config(git_pack_config);
1240
1241
progress = isatty(2);
1242
for (i = 1; i < argc; i++) {