From: Junio C Hamano Date: Tue, 16 May 2006 01:26:34 +0000 (-0700) Subject: Merge branch 'master' into next X-Git-Tag: v1.4.1-rc1~101 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/35702a983e2d8e6bb7b0ebff4016648f407366a2?hp=-c Merge branch 'master' into next * master: Fix silly typo in new builtin grep Fix pack-index issue on 64-bit platforms a bit more portably. Install git-send-email by default Fix compilation on newer NetBSD systems --- 35702a983e2d8e6bb7b0ebff4016648f407366a2 diff --combined Makefile index 506f640793,93779b06f1..55d193780f --- a/Makefile +++ b/Makefile @@@ -206,7 -206,7 +206,7 @@@ DIFF_OBJS = diffcore-delta.o log-tree.o LIB_OBJS = \ - blob.o commit.o connect.o csum-file.o base85.o \ + blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \ date.o diff-delta.o entry.o exec_cmd.o ident.o index.o \ object.o pack-check.o patch-delta.o path.o pkt-line.o \ quote.o read-cache.o refs.o run-command.o \ @@@ -287,7 -287,9 +287,9 @@@ ifeq ($(uname_S),OpenBSD ALL_LDFLAGS += -L/usr/local/lib endif ifeq ($(uname_S),NetBSD) - NEEDS_LIBICONV = YesPlease + ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) + NEEDS_LIBICONV = YesPlease + endif ALL_CFLAGS += -I/usr/pkg/include ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib endif @@@ -607,9 -609,6 +609,9 @@@ test-date$X: test-date.c date.o ctype. test-delta$X: test-delta.c diff-delta.o patch-delta.o $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^ +test-dump-cache-tree$X: dump-cache-tree.o $(GITLIBS) + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) + check: for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done diff --combined pack-objects.c index b430b02cf7,0dbda2cd9f..566a2a2349 --- a/pack-objects.c +++ b/pack-objects.c @@@ -10,7 -10,6 +10,6 @@@ #include "tree-walk.h" #include #include - #include static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list"; @@@ -157,7 -156,7 +156,7 @@@ static void prepare_pack_revindex(struc rix->revindex = xmalloc(sizeof(unsigned long) * (num_ent + 1)); for (i = 0; i < num_ent; i++) { - uint32_t hl = *((uint32_t *)(index + 24 * i)); + unsigned int hl = *((unsigned int *)(index + 24 * i)); rix->revindex[i] = ntohl(hl); } /* This knows the pack format -- the 20-byte trailer @@@ -1039,8 -1038,8 +1038,8 @@@ static int try_delta(struct unpacked *t /* Now some size filtering euristics. */ size = trg_entry->size; - max_size = size / 2 - 20; - if (trg_entry->delta) + max_size = (size/2 - 20) / (src_entry->depth + 1); + if (trg_entry->delta && trg_entry->delta_size <= max_size) max_size = trg_entry->delta_size-1; src_size = src_entry->size; sizediff = src_size < size ? size - src_size : 0; @@@ -1105,14 -1104,17 +1104,14 @@@ static void find_deltas(struct object_e if (entry->size < 50) continue; - if (n->index) - free_delta_index(n->index); + free_delta_index(n->index); + n->index = NULL; free(n->data); n->entry = entry; n->data = read_sha1_file(entry->sha1, type, &size); if (size != entry->size) die("object %s inconsistent object length (%lu vs %lu)", sha1_to_hex(entry->sha1), size, entry->size); - n->index = create_delta_index(n->data, size); - if (!n->index) - die("out of memory"); j = window; while (--j > 0) { @@@ -1126,17 -1128,15 +1125,17 @@@ if (try_delta(n, m, m->index, depth) < 0) break; } -#if 0 /* if we made n a delta, and if n is already at max * depth, leaving it in the window is pointless. we * should evict it first. - * ... in theory only; somehow this makes things worse. */ if (entry->delta && depth <= entry->depth) continue; -#endif + + n->index = create_delta_index(n->data, size); + if (!n->index) + die("out of memory"); + idx++; if (idx >= window) idx = 0; @@@ -1146,7 -1146,8 +1145,7 @@@ fputc('\n', stderr); for (i = 0; i < window; ++i) { - if (array[i].index) - free_delta_index(array[i].index); + free_delta_index(array[i].index); free(array[i].data); } free(array);