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>
This commit is contained in:
Jeff King 2006-07-23 01:50:30 -04:00 committed by Junio C Hamano
parent 8eb38cad44
commit 4812a93a8c
2 changed files with 16 additions and 1 deletions

View File

@ -193,6 +193,10 @@ merge.summary::
Whether to include summaries of merged commits in newly created Whether to include summaries of merged commits in newly created
merge commit messages. False by default. merge commit messages. False by default.
pack.window::
The size of the window used by gitlink:git-pack-objects[1] when no
window size is given on the command line. Defaults to 10.
pull.octopus:: pull.octopus::
The default merge strategy to use when pulling multiple branches The default merge strategy to use when pulling multiple branches
at once. at once.

View File

@ -63,6 +63,7 @@ static const char *base_name;
static unsigned char pack_file_sha1[20]; static unsigned char pack_file_sha1[20];
static int progress = 1; static int progress = 1;
static volatile sig_atomic_t progress_update = 0; static volatile sig_atomic_t progress_update = 0;
static int window = 10;
/* /*
* The object names in objects array are hashed with this hashtable, * The object names in objects array are hashed with this hashtable,
@ -1216,16 +1217,26 @@ static void setup_progress_signal(void)
setitimer(ITIMER_REAL, &v, NULL); setitimer(ITIMER_REAL, &v, NULL);
} }
static int git_pack_config(const char *k, const char *v)
{
if(!strcmp(k, "pack.window")) {
window = git_config_int(k, v);
return 0;
}
return git_default_config(k, v);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
SHA_CTX ctx; SHA_CTX ctx;
char line[40 + 1 + PATH_MAX + 2]; char line[40 + 1 + PATH_MAX + 2];
int window = 10, depth = 10, pack_to_stdout = 0; int depth = 10, pack_to_stdout = 0;
struct object_entry **list; struct object_entry **list;
int num_preferred_base = 0; int num_preferred_base = 0;
int i; int i;
setup_git_directory(); setup_git_directory();
git_config(git_pack_config);
progress = isatty(2); progress = isatty(2);
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {