aboutsummaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:35:47 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:35:47 -0700
commitf846bbff1507ebd0f25e480feacef2954a2629dd (patch)
tree640a42e75e45f0e5534c8c3ca862c8263ab07850 /pack-objects.c
parent75c42d8cc3b42e4b82946848b8ba902b4bbcc38d (diff)
downloadgit-f846bbff1507ebd0f25e480feacef2954a2629dd.tar.gz
git-f846bbff1507ebd0f25e480feacef2954a2629dd.tar.xz
git-pack-objects: make "--window=x" semantics more logical.
A zero disables delta generation (like before), but we make the window be one bigger than specified, since we use one entry for the one to be tested (it used to be that "--window=1" was meaningless, since we'd have used up the single-entry window with the entry to be tested, and had no chance of actually ever finding a delta). The default window remains at 10, but now it really means "test the 10 closest objects", not "test the 9 closest objects".
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pack-objects.c b/pack-objects.c
index d9328a98d..6c24f641d 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -26,7 +26,6 @@ struct object_entry {
static struct object_entry **sorted_by_sha, **sorted_by_type;
static struct object_entry *objects = NULL;
static int nr_objects = 0, nr_alloc = 0;
-static int delta_window = 10;
static const char *base_name;
struct myfile {
@@ -364,6 +363,7 @@ static void find_deltas(struct object_entry **list, int window)
int main(int argc, char **argv)
{
char line[128];
+ int window = 10;
int i;
for (i = 1; i < argc; i++) {
@@ -372,7 +372,7 @@ int main(int argc, char **argv)
if (*arg == '-') {
if (!strncmp("--window=", arg, 9)) {
char *end;
- delta_window = strtoul(arg+9, &end, 0);
+ window = strtoul(arg+9, &end, 0);
if (!arg[9] || *end)
usage(pack_usage);
continue;
@@ -399,8 +399,8 @@ int main(int argc, char **argv)
sorted_by_sha = create_sorted_list(sha1_sort);
sorted_by_type = create_sorted_list(type_size_sort);
- if (delta_window)
- find_deltas(sorted_by_type, delta_window);
+ if (window)
+ find_deltas(sorted_by_type, window+1);
write_pack_file();
write_index_file();