MCPcopy Create free account
hub / github.com/git/git / do_compress

Function do_compress

builtin/pack-objects.c:387–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387static unsigned long do_compress(void **pptr, unsigned long size)
388{
389 git_zstream stream;
390 void *in, *out;
391 unsigned long maxsize;
392 struct repo_config_values *cfg = repo_config_values(the_repository);
393
394 git_deflate_init(&stream, cfg->pack_compression_level);
395 maxsize = git_deflate_bound(&stream, size);
396
397 in = *pptr;
398 out = xmalloc(maxsize);
399 *pptr = out;
400
401 stream.next_in = in;
402 stream.avail_in = size;
403 stream.next_out = out;
404 stream.avail_out = maxsize;
405 while (git_deflate(&stream, Z_FINISH) == Z_OK)
406 ; /* nothing */
407 git_deflate_end(&stream);
408
409 free(in);
410 return stream.total_out;
411}
412
413static unsigned long write_large_blob_data(struct odb_read_stream *st, struct hashfile *f,
414 const struct object_id *oid)

Callers 2

write_no_reuse_objectFunction · 0.70
find_deltasFunction · 0.70

Calls 6

git_deflate_initFunction · 0.85
git_deflate_boundFunction · 0.85
git_deflateFunction · 0.85
git_deflate_endFunction · 0.85
repo_config_valuesClass · 0.70
xmallocFunction · 0.50

Tested by

no test coverage detected