Code

Turn builtin_exec_path into a function.
[git.git] / builtin-pack-objects.c
index 4c2e0cd27cd6fb963adb2b5e572312869eae3f5d..447d492dbbfb578b8903293fa1d2a988eecfefac 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);