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
diff options
context:
space:
mode:
authorNeeraj Singh <neerajsi@microsoft.com>2022-03-30 21:14:15 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-31 00:46:47 +0300
commitc4e707f858813c097bd8b488baae07096aa280ad (patch)
treef172be5059e3fc91ef9e289d6dd461bb3d5a6f84 /object-file.c
parent805e0a68082a217f0112db9ee86a022227a9c81b (diff)
object-file: pass filename to fsync_or_die
If we die while trying to fsync a loose object file, pass the actual filename we're trying to sync. This is likely to be more helpful for a user trying to diagnose the cause of the failure than the former 'loose object file' string. It also sidesteps any concerns about translating the die message differently for loose objects versus something else that has a real path. Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
-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;