]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-pack-objects.c
Merge branch 'jc/maint-diff-quiet'
[git.git] / builtin-pack-objects.c
index 501f9367cb81b3eacce6ef0499a0d0858c6a2843..ba2cf00f5ec60bcfcefe120746422f086559a1ae 100644 (file)
@@ -492,9 +492,9 @@ static void write_pack_file(void)
                } else if (nr_written == nr_remaining) {
                        sha1close(f, sha1, CSUM_FSYNC);
                } else {
-                       int fd = sha1close(f, NULL, 0);
+                       int fd = sha1close(f, sha1, 0);
                        fixup_pack_header_footer(fd, sha1, pack_tmp_name,
-                                                nr_written, NULL, 0);
+                                                nr_written, sha1, offset);
                        close(fd);
                }
 
@@ -1091,9 +1091,12 @@ static void check_object(struct object_entry *entry)
        }
 
        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)
@@ -1717,8 +1720,12 @@ static void prepare_pack(int window, int depth)
                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;
        }