Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-01-02 15:37:19 +0300
committerJunio C Hamano <gitster@pobox.com>2023-01-02 15:37:19 +0300
commit3ed91c5f22084eaf8c3a324fb82017fec8361a14 (patch)
tree6460c0cd82256a3ee41651b0637e5e0e9cb04e56 /refs
parent039e5a0b701c76dce38c397853cea490d5a27373 (diff)
parentce54672f9b017adf60d15bc7174994b63cb29d3a (diff)
Merge branch 'ps/fsync-refs-fix'
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
Diffstat (limited to 'refs')
-rw-r--r--refs/packed-backend.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index c1c71d183e..6f5a0709fb 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1263,7 +1263,8 @@ static int write_with_updates(struct packed_ref_store *refs,
goto error;
}
- if (fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
+ if (fflush(out) ||
+ fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
close_tempfile_gently(refs->tempfile)) {
strbuf_addf(err, "error closing file %s: %s",
get_tempfile_path(refs->tempfile),