Merge branch 'master' into next
authorJunio C Hamano <junkio@cox.net>
Tue, 16 May 2006 01:26:34 +0000 (18:26 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 16 May 2006 01:26:34 +0000 (18:26 -0700)
* 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

1  2 
Makefile
pack-objects.c
diff --combined Makefile
index 506f6407935b20ba5efbd1f09390bfb2cd3c2d58,93779b06f1a12989a6920cbc2a09170d70e62730..55d193780fd49768ed8a8490059a82387ba3b4ee
+++ 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 b430b02cf7f5b39c97bc090634ef26346a022ade,0dbda2cd9f017cd666d58c3e034ccb5136039c20..566a2a2349871d05378b1b8de27d315b7451f89c
@@@ -10,7 -10,6 +10,6 @@@
  #include "tree-walk.h"
  #include <sys/time.h>
  #include <signal.h>
- #include <stdint.h>
  
  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) {
                        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;
                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);