Merge branch 'sp/missing-thin-base' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 30 Aug 2008 15:38:19 +0000 (08:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Aug 2008 15:38:19 +0000 (08:38 -0700)
* sp/missing-thin-base:
pack-objects: Allow missing base objects when creating thin packs

1  2 
builtin-pack-objects.c
diff --combined builtin-pack-objects.c
index d394c494a55d45a7af6506371f3432374dffe424,b43e0b8f27b1ead12c04d99a393e8b36f4d2cb46..ef3befe57b3b8298798e51627f076e2a40319cb1
@@@ -499,6 -499,7 +499,6 @@@ static void write_pack_file(void
                } else {
                        int fd = sha1close(f, NULL, 0);
                        fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
 -                      fsync_or_die(fd, pack_tmp_name);
                        close(fd);
                }
  
@@@ -1095,9 -1096,12 +1095,12 @@@ static void check_object(struct object_
        }
  
        entry->type = sha1_object_info(entry->idx.sha1, &entry->size);
-       if (entry->type < 0)
-               die("unable to get type of object %s",
-                   sha1_to_hex(entry->idx.sha1));
+       /*
+        * The error condition is checked in prepare_pack().  This is
+        * to permit a missing preferred base object to be ignored
+        * as a preferred base.  Doing so can result in a larger
+        * pack file, but the transfer will still take place.
+        */
  }
  
  static int pack_offset_sort(const void *_a, const void *_b)
@@@ -1721,8 -1725,12 +1724,12 @@@ static void prepare_pack(int window, in
                if (entry->no_try_delta)
                        continue;
  
-               if (!entry->preferred_base)
+               if (!entry->preferred_base) {
                        nr_deltas++;
+                       if (entry->type < 0)
+                               die("unable to get type of object %s",
+                                   sha1_to_hex(entry->idx.sha1));
+               }
  
                delta_list[n++] = entry;
        }