@matheusbsbs / matheus-bagliano / commits / 54352bb274
Fork 0

Remove now unnecessary 'sync()' calls

Since the pack-files are now always created stably on disk, there is no need to sync() before pruning lose objects or old stale pack-files. [jc: with Nico's clean-up] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Linus Torvalds committed May 30, 2008 at 08:54 UTC 54352bb2742cfbe53fa820eab53607a46d349ae4
4 files changed +4 -6
builtin-pack-objects.c
+4 -3
@@ -514,9 +514,10 @@ static void write_pack_file(void)
514 * Did we write the wrong # entries in the header?
515 * If so, rewrite it like in fast-import
516 */
517 - if (pack_to_stdout || nr_written == nr_remaining) {
518 - unsigned flags = pack_to_stdout ? CSUM_CLOSE : CSUM_FSYNC;
519 - sha1close(f, sha1, flags);
517 + if (pack_to_stdout) {
518 + sha1close(f, sha1, CSUM_CLOSE);
519 + } else if (nr_written == nr_remaining) {
520 + sha1close(f, sha1, CSUM_FSYNC);
521 } else {
522 int fd = sha1close(f, NULL, 0);
523 fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
builtin-prune-packed.c
-1
@@ -85,7 +85,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
85 /* Handle arguments here .. */
86 usage(prune_packed_usage);
87 }
88 - sync();
88 prune_packed_objects(opts);
89 return 0;
90 }
builtin-prune.c
-1
@@ -156,7 +156,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
156 mark_reachable_objects(&revs, 1);
157 prune_object_dir(get_object_directory());
158
159 - sync();
159 prune_packed_objects(show_only);
160 remove_temporary_files();
161 return 0;
git-repack.sh
-1
@@ -125,7 +125,6 @@ then
125 # We know $existing are all redundant.
126 if [ -n "$existing" ]
127 then
128 - sync
128 ( cd "$PACKDIR" &&
129 for e in $existing
130 do