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

Function generated_pack_install

repack.c:373–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void generated_pack_install(struct generated_pack *pack, const char *name,
374 const char *packdir, const char *packtmp)
375{
376 size_t ext;
377 for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
378 char *fname;
379
380 fname = mkpathdup("%s/pack-%s%s", packdir, name,
381 exts[ext].name);
382
383 if (pack->tempfiles[ext]) {
384 const char *fname_old = get_tempfile_path(pack->tempfiles[ext]);
385 struct stat statbuffer;
386
387 if (!stat(fname_old, &statbuffer)) {
388 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
389 chmod(fname_old, statbuffer.st_mode);
390 }
391
392 if (rename_tempfile(&pack->tempfiles[ext], fname))
393 die_errno(_("renaming pack to '%s' failed"),
394 fname);
395 } else if (!exts[ext].optional)
396 die(_("pack-objects did not write a '%s' file for pack %s-%s"),
397 exts[ext].name, packtmp, name);
398 else if (unlink(fname) < 0 && errno != ENOENT)
399 die_errno(_("could not unlink: %s"), fname);
400
401 free(fname);
402 }
403}

Callers 1

cmd_repackFunction · 0.85

Calls 6

mkpathdupFunction · 0.85
get_tempfile_pathFunction · 0.85
rename_tempfileFunction · 0.85
die_errnoFunction · 0.85
statClass · 0.70
dieFunction · 0.70

Tested by

no test coverage detected