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

Function write_message

sequencer.c:566–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564}
565
566static int write_message(const void *buf, size_t len, const char *filename,
567 int append_eol)
568{
569 struct lock_file msg_file = LOCK_INIT;
570
571 int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
572 if (msg_fd < 0)
573 return error_errno(_("could not lock '%s'"), filename);
574 if (write_in_full(msg_fd, buf, len) < 0) {
575 error_errno(_("could not write to '%s'"), filename);
576 rollback_lock_file(&msg_file);
577 return -1;
578 }
579 if (append_eol && write(msg_fd, "\n", 1) < 0) {
580 error_errno(_("could not write eol to '%s'"), filename);
581 rollback_lock_file(&msg_file);
582 return -1;
583 }
584 if (commit_lock_file(&msg_file) < 0)
585 return error(_("failed to finalize '%s'"), filename);
586
587 return 0;
588}
589
590int read_oneliner(struct strbuf *buf,
591 const char *path, unsigned flags)

Callers 13

write_author_scriptFunction · 0.85
append_squash_messageFunction · 0.85
update_squash_messagesFunction · 0.85
do_pick_commitFunction · 0.85
save_headFunction · 0.85
make_patchFunction · 0.85
intend_to_amendFunction · 0.85
error_with_patchFunction · 0.85
do_resetFunction · 0.85
do_mergeFunction · 0.85
commit_staged_changesFunction · 0.85

Calls 6

error_errnoFunction · 0.85
write_in_fullFunction · 0.85
rollback_lock_fileFunction · 0.85
commit_lock_fileFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected