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

Function odb_mkstemp

odb.c:35–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 struct odb_source *, 1, fspathhash, fspatheq)
34
35int odb_mkstemp(struct object_database *odb,
36 struct strbuf *temp_filename, const char *pattern)
37{
38 int fd;
39 /*
40 * we let the umask do its job, don't try to be more
41 * restrictive except to remove write permission.
42 */
43 int mode = 0444;
44 repo_git_path_replace(odb->repo, temp_filename, "objects/%s", pattern);
45 fd = git_mkstemp_mode(temp_filename->buf, mode);
46 if (0 <= fd)
47 return fd;
48
49 /* slow path */
50 /* some mkstemp implementations erase temp_filename on failure */
51 repo_git_path_replace(odb->repo, temp_filename, "objects/%s", pattern);
52 safe_create_leading_directories(odb->repo, temp_filename->buf);
53 return xmkstemp_mode(temp_filename->buf, mode);
54}
55
56/*
57 * Return non-zero iff the path is usable as an alternate object database.

Callers 8

find_temp_filenameFunction · 0.85
write_idx_fileFunction · 0.85
write_rev_file_orderFunction · 0.85
write_mtimes_fileFunction · 0.85
create_tmp_packfileFunction · 0.85
bitmap_writer_finishFunction · 0.85
open_pack_fileFunction · 0.85
start_packfileFunction · 0.85

Calls 4

repo_git_path_replaceFunction · 0.85
git_mkstemp_modeFunction · 0.85
xmkstemp_modeFunction · 0.85

Tested by

no test coverage detected