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

Function setup_temporary_shallow

shallow.c:415–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415const char *setup_temporary_shallow(const struct oid_array *extra)
416{
417 struct tempfile *temp;
418 struct strbuf sb = STRBUF_INIT;
419
420 if (write_shallow_commits(&sb, 0, extra)) {
421 char *path = repo_git_path(the_repository, "shallow_XXXXXX");
422 temp = xmks_tempfile(path);
423 free(path);
424
425 if (write_in_full(temp->fd, sb.buf, sb.len) < 0 ||
426 close_tempfile_gently(temp) < 0)
427 die_errno("failed to write to %s",
428 get_tempfile_path(temp));
429 strbuf_release(&sb);
430 return get_tempfile_path(temp);
431 }
432 /*
433 * is_repository_shallow() sees empty string as "no shallow
434 * file".
435 */
436 return "";
437}
438
439void setup_alternate_shallow(struct shallow_lock *shallow_lock,
440 const char **alternate_shallow_file,

Callers 3

do_fetch_packFunction · 0.85
receive_shallow_infoFunction · 0.85
unpackFunction · 0.85

Calls 8

write_shallow_commitsFunction · 0.85
repo_git_pathFunction · 0.85
xmks_tempfileFunction · 0.85
write_in_fullFunction · 0.85
close_tempfile_gentlyFunction · 0.85
die_errnoFunction · 0.85
get_tempfile_pathFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected