builtin-merge: avoid run_command_v_opt() for recursive and subtree
[gitweb.git] / pack-write.c
index c66c8af725f6d37b4edaeab75eebac7a387f4922..ddcfd37af263a5fe1009473cba879b00f4b6692d 100644 (file)
@@ -2,7 +2,7 @@
 #include "pack.h"
 #include "csum-file.h"
 
-uint32_t pack_idx_default_version = 1;
+uint32_t pack_idx_default_version = 2;
 uint32_t pack_idx_off32_limit = 0x7fffffff;
 
 static int sha1_compare(const void *_a, const void *_b)
@@ -139,7 +139,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
        }
 
        sha1write(f, sha1, 20);
-       sha1close(f, NULL, 1);
+       sha1close(f, NULL, CSUM_FSYNC);
        SHA1_Final(sha1, &ctx);
        return index_name;
 }
@@ -179,6 +179,7 @@ void fixup_pack_header_footer(int pack_fd,
 
        SHA1_Final(pack_file_sha1, &c);
        write_or_die(pack_fd, pack_file_sha1, 20);
+       fsync_or_die(pack_fd, pack_name);
 }
 
 char *index_pack_lockfile(int ip_out)