diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-26 11:42:06 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-26 11:42:06 +0900 |
commit | d4539b5c713b6584893e582f1e431bc04f4f600e (patch) | |
tree | 2251c531b82034e72e80ab00d31b8f160f9ddade | |
parent | b0c61be3209b41c26684f813714c8dabb71c34b9 (diff) | |
parent | d422d06167af35bbe81026ee75c14eaa6b93127c (diff) | |
download | git-d4539b5c713b6584893e582f1e431bc04f4f600e.tar.gz |
Merge branch 'rs/clarify-error-in-write-loose-object'
Code clean-up.
* rs/clarify-error-in-write-loose-object:
object-file: inline write_buffer()
-rw-r--r-- | object-file.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/object-file.c b/object-file.c index 26290554bb..c1b71c2834 100644 --- a/object-file.c +++ b/object-file.c @@ -1864,13 +1864,6 @@ out: return 0; } -static int write_buffer(int fd, const void *buf, size_t len) -{ - if (write_in_full(fd, buf, len) < 0) - return error_errno(_("file write error")); - return 0; -} - static void hash_object_file_literally(const struct git_hash_algo *algo, const void *buf, unsigned long len, const char *type, struct object_id *oid) @@ -2015,8 +2008,8 @@ static int write_loose_object_common(git_hash_ctx *c, ret = git_deflate(stream, flush ? Z_FINISH : 0); the_hash_algo->update_fn(c, in0, stream->next_in - in0); - if (write_buffer(fd, compressed, stream->next_out - compressed) < 0) - die(_("unable to write loose object file")); + if (write_in_full(fd, compressed, stream->next_out - compressed) < 0) + die_errno(_("unable to write loose object file")); stream->next_out = compressed; stream->avail_out = compressed_len; |