diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-07-30 10:00:42 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-07-31 08:59:56 -0700 |
| commit | 627a292a1139c96f5de80084ab5ce8b852db5132 (patch) | |
| tree | 581042caea1a1957a8df5f2b85a8662b32c3cdaf /src/Package/Fetch/git.zig | |
| parent | 1a15fbe9607c74096c875f6d871213c7d4db1483 (diff) | |
| download | zig-627a292a1139c96f5de80084ab5ce8b852db5132.tar.gz zig-627a292a1139c96f5de80084ab5ce8b852db5132.zip | |
fetch: remove calls to fsync
fsync blocks until the contents have been actually written to disk,
which would be useful if we didn't want to report success until having
achieved durability. But the OS will ensure coherency; i.e. if one
process writes stuff without calling fsync, then another process reads
that stuff, the writes will be seen even if they didn't get flushed to
disk yet.
Since this code deals with ephemeral cache data, it's not worth trying
to achieve this kind of durability guarantee. This is consistent with
all the other tooling on the system.
Certainly, if we wanted to change our stance on this, it would not be
something that affects only the git fetching logic.
Diffstat (limited to 'src/Package/Fetch/git.zig')
| -rw-r--r-- | src/Package/Fetch/git.zig | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig index a8446d48a8..34d373f553 100644 --- a/src/Package/Fetch/git.zig +++ b/src/Package/Fetch/git.zig @@ -238,7 +238,6 @@ pub const Repository = struct { }; defer file.close(); try file.writeAll(file_object.data); - try file.sync(); }, .symlink => { try repository.odb.seekOid(entry.oid); @@ -1690,7 +1689,6 @@ pub fn main() !void { var index_buffered_writer = std.io.bufferedWriter(index_file.deprecatedWriter()); try indexPack(allocator, format, pack_file, index_buffered_writer.writer()); try index_buffered_writer.flush(); - try index_file.sync(); std.debug.print("Starting checkout...\n", .{}); var repository = try Repository.init(allocator, format, pack_file, index_file); |
