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

Function do_commit

sequencer.c:1720–1758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1718}
1719
1720static int do_commit(struct repository *r,
1721 const char *msg_file, const char *author,
1722 const char *reflog_action,
1723 struct replay_opts *opts, unsigned int flags,
1724 struct object_id *oid)
1725{
1726 int res = 1;
1727
1728 if (!(flags & EDIT_MSG) && !(flags & VERIFY_MSG)) {
1729 struct object_id oid;
1730 struct strbuf sb = STRBUF_INIT;
1731
1732 if (msg_file && strbuf_read_file(&sb, msg_file, 2048) < 0)
1733 return error_errno(_("unable to read commit message "
1734 "from '%s'"),
1735 msg_file);
1736
1737 res = try_to_commit(r, msg_file ? &sb : NULL,
1738 author, reflog_action, opts, flags, &oid);
1739 strbuf_release(&sb);
1740 if (!res) {
1741 refs_delete_ref(get_main_ref_store(r), "",
1742 "CHERRY_PICK_HEAD", NULL, REF_NO_DEREF);
1743 unlink(git_path_merge_msg(r));
1744 if (!is_rebase_i(opts))
1745 print_commit_summary(r, NULL, &oid,
1746 SUMMARY_SHOW_AUTHOR_DATE);
1747 return res;
1748 }
1749 }
1750 if (res == 1) {
1751 if (is_rebase_i(opts) && oid)
1752 if (write_rebase_head(oid))
1753 return -1;
1754 return run_git_commit(msg_file, reflog_action, opts, flags);
1755 }
1756
1757 return res;
1758}
1759
1760static int is_original_commit_empty(struct commit *commit)
1761{

Callers 1

do_pick_commitFunction · 0.70

Calls 10

strbuf_read_fileFunction · 0.85
error_errnoFunction · 0.85
try_to_commitFunction · 0.85
strbuf_releaseFunction · 0.85
refs_delete_refFunction · 0.85
get_main_ref_storeFunction · 0.85
is_rebase_iFunction · 0.85
print_commit_summaryFunction · 0.85
write_rebase_headFunction · 0.85
run_git_commitFunction · 0.85

Tested by

no test coverage detected