diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-02-14 14:15:57 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-14 14:15:57 -0800 |
| commit | ff6c740339048f400c9e05cac1b33e7a8ee218de (patch) | |
| tree | 57a8b0289eb0b89c17a7ca492e7eef1c6d9ea370 /object-file.c | |
| parent | Merge branch 'rs/reflog-expiry-cleanup' into maint-2.39 (diff) | |
| parent | object-file: inline write_buffer() (diff) | |
| download | git-ff6c740339048f400c9e05cac1b33e7a8ee218de.tar.gz git-ff6c740339048f400c9e05cac1b33e7a8ee218de.zip | |
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()
Diffstat (limited to 'object-file.c')
| -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; |
