diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-26 02:38:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-26 02:38:25 +0300 |
commit | 6e1a8952e90e5d125177dbdee21425d1ba2d3584 (patch) | |
tree | cda2c48629c1e926d5b971954a038e79f0f0a325 /refs/packed-backend.c | |
parent | eb804cd405618ef78b772072685c39392aea4ac1 (diff) | |
parent | bc22d845c4328f5bd896d019b3729f776ad4be4c (diff) |
Merge branch 'ps/fsync-refs'
Updates to refs traditionally weren't fsync'ed, but we can
configure using core.fsync variable to do so.
* ps/fsync-refs:
core.fsync: new option to harden references
Diffstat (limited to 'refs/packed-backend.c')
-rw-r--r-- | refs/packed-backend.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/refs/packed-backend.c b/refs/packed-backend.c index f56e2cc635..55a1426e67 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -1262,7 +1262,8 @@ static int write_with_updates(struct packed_ref_store *refs, goto error; } - if (close_tempfile_gently(refs->tempfile)) { + if (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), strerror(errno)); |