Skip to content

Commit ff6c740

Browse files
committed
Merge branch 'rs/clarify-error-in-write-loose-object' into maint-2.39
Code clean-up. * rs/clarify-error-in-write-loose-object: object-file: inline write_buffer()
2 parents 651b443 + d422d06 commit ff6c740

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

object-file.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,13 +1864,6 @@ int finalize_object_file(const char *tmpfile, const char *filename)
18641864
return 0;
18651865
}
18661866

1867-
static int write_buffer(int fd, const void *buf, size_t len)
1868-
{
1869-
if (write_in_full(fd, buf, len) < 0)
1870-
return error_errno(_("file write error"));
1871-
return 0;
1872-
}
1873-
18741867
static void hash_object_file_literally(const struct git_hash_algo *algo,
18751868
const void *buf, unsigned long len,
18761869
const char *type, struct object_id *oid)
@@ -2015,8 +2008,8 @@ static int write_loose_object_common(git_hash_ctx *c,
20152008

20162009
ret = git_deflate(stream, flush ? Z_FINISH : 0);
20172010
the_hash_algo->update_fn(c, in0, stream->next_in - in0);
2018-
if (write_buffer(fd, compressed, stream->next_out - compressed) < 0)
2019-
die(_("unable to write loose object file"));
2011+
if (write_in_full(fd, compressed, stream->next_out - compressed) < 0)
2012+
die_errno(_("unable to write loose object file"));
20202013
stream->next_out = compressed;
20212014
stream->avail_out = compressed_len;
20222015

0 commit comments

Comments
 (0)