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

Function write_mtimes_file

pack-write.c:333–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333static char *write_mtimes_file(struct repository *repo,
334 struct packing_data *to_pack,
335 struct pack_idx_entry **objects,
336 uint32_t nr_objects,
337 const unsigned char *hash)
338{
339 struct strbuf tmp_file = STRBUF_INIT;
340 char *mtimes_name;
341 struct hashfile *f;
342 int fd;
343
344 if (!to_pack)
345 BUG("cannot call write_mtimes_file with NULL packing_data");
346
347 fd = odb_mkstemp(repo->objects, &tmp_file, "pack/tmp_mtimes_XXXXXX");
348 mtimes_name = strbuf_detach(&tmp_file, NULL);
349 f = hashfd(repo->hash_algo, fd, mtimes_name);
350
351 write_mtimes_header(repo->hash_algo, f);
352 write_mtimes_objects(f, to_pack, objects, nr_objects);
353 write_mtimes_trailer(repo->hash_algo, f, hash);
354
355 if (adjust_shared_perm(repo, mtimes_name) < 0)
356 die(_("failed to make %s readable"), mtimes_name);
357
358 finalize_hashfile(f, NULL, FSYNC_COMPONENT_PACK_METADATA,
359 CSUM_HASH_IN_STREAM | CSUM_CLOSE | CSUM_FSYNC);
360
361 return mtimes_name;
362}
363
364off_t write_pack_header(struct hashfile *f, uint32_t nr_entries)
365{

Callers 1

stage_tmp_packfilesFunction · 0.85

Calls 9

odb_mkstempFunction · 0.85
strbuf_detachFunction · 0.85
hashfdFunction · 0.85
write_mtimes_headerFunction · 0.85
write_mtimes_objectsFunction · 0.85
write_mtimes_trailerFunction · 0.85
adjust_shared_permFunction · 0.85
finalize_hashfileFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected