Ship sample hooks with .sample suffix
[gitweb.git] / builtin-pack-objects.c
index 4c2e0cd27cd6fb963adb2b5e572312869eae3f5d..827673ce4e81e14e13ae4b41ac89c18f6201ddb6 100644 (file)
@@ -514,9 +514,10 @@ static void write_pack_file(void)
                 * Did we write the wrong # entries in the header?
                 * If so, rewrite it like in fast-import
                 */
-               if (pack_to_stdout || nr_written == nr_remaining) {
-                       unsigned flags = pack_to_stdout ? CSUM_CLOSE : CSUM_FSYNC;
-                       sha1close(f, sha1, flags);
+               if (pack_to_stdout) {
+                       sha1close(f, sha1, CSUM_CLOSE);
+               } else if (nr_written == nr_remaining) {
+                       sha1close(f, sha1, CSUM_FSYNC);
                } else {
                        int fd = sha1close(f, NULL, 0);
                        fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
@@ -1147,8 +1148,6 @@ static void get_object_details(void)
                sorted_by_offset[i] = objects + i;
        qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort);
 
-       init_pack_revindex();
-
        for (i = 0; i < nr_objects; i++)
                check_object(sorted_by_offset[i]);