MCPcopy Index your code
hub / github.com/git/git / write_loose_object_common

Function write_loose_object_common

object-file.c:704–724  ·  view source on GitHub ↗

* Common steps for the inner git_deflate() loop for writing loose * objects. Returns what git_deflate() returns. */

Source from the content-addressed store, hash-verified

702 * objects. Returns what git_deflate() returns.
703 */
704static int write_loose_object_common(struct odb_source_loose *loose,
705 struct git_hash_ctx *c, struct git_hash_ctx *compat_c,
706 git_zstream *stream, const int flush,
707 unsigned char *in0, const int fd,
708 unsigned char *compressed,
709 const size_t compressed_len)
710{
711 const struct git_hash_algo *compat = loose->base.odb->repo->compat_hash_algo;
712 int ret;
713
714 ret = git_deflate(stream, flush ? Z_FINISH : 0);
715 git_hash_update(c, in0, stream->next_in - in0);
716 if (compat && compat_c)
717 git_hash_update(compat_c, in0, stream->next_in - in0);
718 if (write_in_full(fd, compressed, stream->next_out - compressed) < 0)
719 die_errno(_("unable to write loose object file"));
720 stream->next_out = compressed;
721 stream->avail_out = compressed_len;
722
723 return ret;
724}
725
726/**
727 * Common steps for loose object writers to end writing loose objects:

Callers 2

write_loose_objectFunction · 0.85

Calls 4

git_deflateFunction · 0.85
git_hash_updateFunction · 0.85
write_in_fullFunction · 0.85
die_errnoFunction · 0.85

Tested by

no test coverage detected