summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:22 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-04-04 10:56:22 -0700
commit98f6a3a35335d5d4b48df0088f2da0075e07f99c (patch)
tree0c90da4f136d2c2d5479eb6225b648b62d87ef5c
parentMerge branch 'ns/core-fsyncmethod' (diff)
parentobject-file: pass filename to fsync_or_die (diff)
downloadtgif-98f6a3a35335d5d4b48df0088f2da0075e07f99c.tar.xz
Merge branch 'ns/fsync-or-die-message-fix'
When creating a loose object file, we didn't report the exact filename of the file we failed to fsync, even though the information was readily available, which has been corrected. * ns/fsync-or-die-message-fix: object-file: pass filename to fsync_or_die
-rw-r--r--object-file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/object-file.c b/object-file.c
index b254bc50d7..5ffbf3d4fd 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1888,16 +1888,16 @@ void hash_object_file(const struct git_hash_algo *algo, const void *buf,
}
/* Finalize a file on disk, and close it. */
-static void close_loose_object(int fd)
+static void close_loose_object(int fd, const char *filename)
{
if (the_repository->objects->odb->will_destroy)
goto out;
if (fsync_object_files > 0)
- fsync_or_die(fd, "loose object file");
+ fsync_or_die(fd, filename);
else
fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd,
- "loose object file");
+ filename);
out:
if (close(fd) != 0)
@@ -2011,7 +2011,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
die(_("confused by unstable object source data for %s"),
oid_to_hex(oid));
- close_loose_object(fd);
+ close_loose_object(fd, tmp_file.buf);
if (mtime) {
struct utimbuf utb;