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

Function write_file_in_place

trailer.c:1320–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1318}
1319
1320static int write_file_in_place(const char *path, const struct strbuf *buf)
1321{
1322 struct tempfile *tempfile = trailer_create_in_place_tempfile(path);
1323 if (!tempfile)
1324 return -1;
1325
1326 if (write_in_full(tempfile->fd, buf->buf, buf->len) < 0)
1327 return error_errno(_("could not write to temporary file"));
1328
1329 if (rename_tempfile(&tempfile, path))
1330 return error_errno(_("could not rename temporary file to %s"), path);
1331
1332 return 0;
1333}
1334
1335int amend_file_with_trailers(const char *path,
1336 const struct strvec *trailer_args)

Callers 1

amend_file_with_trailersFunction · 0.85

Calls 4

write_in_fullFunction · 0.85
error_errnoFunction · 0.85
rename_tempfileFunction · 0.85

Tested by

no test coverage detected