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

Function is_original_commit_empty

sequencer.c:1760–1778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1758}
1759
1760static int is_original_commit_empty(struct commit *commit)
1761{
1762 const struct object_id *ptree_oid;
1763
1764 if (repo_parse_commit(the_repository, commit))
1765 return error(_("could not parse commit %s"),
1766 oid_to_hex(&commit->object.oid));
1767 if (commit->parents) {
1768 struct commit *parent = commit->parents->item;
1769 if (repo_parse_commit(the_repository, parent))
1770 return error(_("could not parse parent commit %s"),
1771 oid_to_hex(&parent->object.oid));
1772 ptree_oid = get_commit_tree_oid(parent);
1773 } else {
1774 ptree_oid = the_hash_algo->empty_tree; /* commit is root */
1775 }
1776
1777 return oideq(ptree_oid, get_commit_tree_oid(commit));
1778}
1779
1780/*
1781 * Should empty commits be allowed? Return status:

Callers 3

allow_emptyFunction · 0.85
make_script_with_mergesFunction · 0.85
sequencer_make_scriptFunction · 0.85

Calls 5

repo_parse_commitFunction · 0.85
errorFunction · 0.85
oid_to_hexFunction · 0.85
get_commit_tree_oidFunction · 0.85
oideqFunction · 0.85

Tested by

no test coverage detected