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

Function write_buf_to_worktree

notes-merge.c:312–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312static void write_buf_to_worktree(const struct object_id *obj,
313 const char *buf, unsigned long size)
314{
315 int fd;
316 char *path = repo_git_path(the_repository, NOTES_MERGE_WORKTREE "/%s", oid_to_hex(obj));
317 if (safe_create_leading_directories_const(the_repository, path))
318 die_errno("unable to create directory for '%s'", path);
319
320 fd = xopen(path, O_WRONLY | O_EXCL | O_CREAT, 0666);
321
322 while (size > 0) {
323 ssize_t ret = write_in_full(fd, buf, size);
324 if (ret < 0) {
325 /* Ignore epipe */
326 if (errno == EPIPE)
327 break;
328 die_errno("notes-merge");
329 }
330 size -= ret;
331 buf += ret;
332 }
333
334 close(fd);
335 free(path);
336}
337
338static void write_note_to_worktree(const struct object_id *obj,
339 const struct object_id *note)

Callers 2

write_note_to_worktreeFunction · 0.85
ll_merge_in_worktreeFunction · 0.85

Calls 6

repo_git_pathFunction · 0.85
oid_to_hexFunction · 0.85
die_errnoFunction · 0.85
xopenFunction · 0.85
write_in_fullFunction · 0.85

Tested by

no test coverage detected