mirror of
https://github.com/git/git.git
synced 2024-11-25 02:44:48 +08:00
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
This commit is contained in:
commit
98f6a3a353
@ -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. */
|
/* 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)
|
if (the_repository->objects->odb->will_destroy)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (fsync_object_files > 0)
|
if (fsync_object_files > 0)
|
||||||
fsync_or_die(fd, "loose object file");
|
fsync_or_die(fd, filename);
|
||||||
else
|
else
|
||||||
fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd,
|
fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd,
|
||||||
"loose object file");
|
filename);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (close(fd) != 0)
|
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"),
|
die(_("confused by unstable object source data for %s"),
|
||||||
oid_to_hex(oid));
|
oid_to_hex(oid));
|
||||||
|
|
||||||
close_loose_object(fd);
|
close_loose_object(fd, tmp_file.buf);
|
||||||
|
|
||||||
if (mtime) {
|
if (mtime) {
|
||||||
struct utimbuf utb;
|
struct utimbuf utb;
|
||||||
|
Loading…
Reference in New Issue
Block a user