Merge branch 'np/pack'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:19:30 +0000 (20:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:19:30 +0000 (20:19 -0700)
* np/pack:
t5300: improve SHA1 collision test
pack-objects: don't include missing preferred base objects
sha1write: don't copy full sized buffers

Conflicts:
t/t5300-pack-object.sh

1  2 
builtin-pack-objects.c
t/t5300-pack-object.sh
diff --combined builtin-pack-objects.c
index 217fd49da9ad98e660e6522024793ae3a357e837,e16b7e8f06faeee4e9d078e8401b615b6ce02be7..5fc1b8c6fb8273c6957ab9d0d98b9b4150843fc5
@@@ -23,7 -23,7 +23,7 @@@
  #endif
  
  static const char pack_usage[] = "\
 -git-pack-objects [{ -q | --progress | --all-progress }] \n\
 +git pack-objects [{ -q | --progress | --all-progress }] \n\
        [--max-pack-size=N] [--local] [--incremental] \n\
        [--window=N] [--window-memory=N] [--depth=N] \n\
        [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] \n\
@@@ -1725,6 -1725,14 +1725,14 @@@ static void prepare_pack(int window, in
                        if (entry->type < 0)
                                die("unable to get type of object %s",
                                    sha1_to_hex(entry->idx.sha1));
+               } else {
+                       if (entry->type < 0) {
+                               /*
+                                * This object is not found, but we
+                                * don't have to include it anyway.
+                                */
+                               continue;
+                       }
                }
  
                delta_list[n++] = entry;
@@@ -1872,7 -1880,7 +1880,7 @@@ static void mark_in_pack_object(struct 
  
  /*
   * Compare the objects in the offset order, in order to emulate the
 - * "git-rev-list --objects" output that produced the pack originally.
 + * "git rev-list --objects" output that produced the pack originally.
   */
  static int ofscmp(const void *a_, const void *b_)
  {
diff --combined t/t5300-pack-object.sh
index 3a0ef8759c9d7a55b95c56ca38cd3c37ac2432fa,8a8b0f1abae5ceeba99eef36a330b6839794145c..b335c6b42de59b9632ff29693c2d7c75dae9794a
@@@ -3,7 -3,7 +3,7 @@@
  # Copyright (c) 2005 Junio C Hamano
  #
  
 -test_description='git-pack-object
 +test_description='git pack-object
  
  '
  . ./test-lib.sh
@@@ -242,24 -242,24 +242,24 @@@ test_expect_success 
  test_expect_success \
      'build pack index for an existing pack' \
      'cat test-1-${packname_1}.pack >test-3.pack &&
 -     git-index-pack -o tmp.idx test-3.pack &&
 +     git index-pack -o tmp.idx test-3.pack &&
       cmp tmp.idx test-1-${packname_1}.idx &&
  
 -     git-index-pack test-3.pack &&
 +     git index-pack test-3.pack &&
       cmp test-3.idx test-1-${packname_1}.idx &&
  
       cat test-2-${packname_2}.pack >test-3.pack &&
 -     git-index-pack -o tmp.idx test-2-${packname_2}.pack &&
 +     git index-pack -o tmp.idx test-2-${packname_2}.pack &&
       cmp tmp.idx test-2-${packname_2}.idx &&
  
 -     git-index-pack test-3.pack &&
 +     git index-pack test-3.pack &&
       cmp test-3.idx test-2-${packname_2}.idx &&
  
       cat test-3-${packname_3}.pack >test-3.pack &&
 -     git-index-pack -o tmp.idx test-3-${packname_3}.pack &&
 +     git index-pack -o tmp.idx test-3-${packname_3}.pack &&
       cmp tmp.idx test-3-${packname_3}.idx &&
  
 -     git-index-pack test-3.pack &&
 +     git index-pack test-3.pack &&
       cmp test-3.idx test-3-${packname_3}.idx &&
  
       :'
@@@ -272,7 -272,8 +272,8 @@@ test_expect_success 
  
  test_expect_success \
      'make sure index-pack detects the SHA1 collision' \
-     'test_must_fail git index-pack -o bad.idx test-3.pack'
 -    'test_must_fail git-index-pack -o bad.idx test-3.pack 2>msg &&
++    'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
+      grep "SHA1 COLLISION FOUND" msg'
  
  test_expect_success \
      'honor pack.packSizeLimit' \