Skip to content

Commit 259988a

Browse files
committed
Merge branch 'ps/fsync-refs-fix' into maint-2.39
Fix the sequence to fsync $GIT_DIR/packed-refs file that forgot to flush its output to the disk.. * ps/fsync-refs-fix: refs: fix corruption by not correctly syncing packed-refs to disk
2 parents 725f293 + ce54672 commit 259988a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

refs/packed-backend.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,8 @@ static int write_with_updates(struct packed_ref_store *refs,
12631263
goto error;
12641264
}
12651265

1266-
if (fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
1266+
if (fflush(out) ||
1267+
fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
12671268
close_tempfile_gently(refs->tempfile)) {
12681269
strbuf_addf(err, "error closing file %s: %s",
12691270
get_tempfile_path(refs->tempfile),

0 commit comments

Comments
 (0)