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

Function parse_head

sequencer.c:1497–1518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1495}
1496
1497static int parse_head(struct repository *r, struct commit **head)
1498{
1499 struct commit *current_head;
1500 struct object_id oid;
1501
1502 if (repo_get_oid(r, "HEAD", &oid)) {
1503 current_head = NULL;
1504 } else {
1505 current_head = lookup_commit_reference(r, &oid);
1506 if (!current_head)
1507 return error(_("could not parse HEAD"));
1508 if (!oideq(&oid, &current_head->object.oid)) {
1509 warning(_("HEAD %s is not a commit!"),
1510 oid_to_hex(&oid));
1511 }
1512 if (repo_parse_commit(r, current_head))
1513 return error(_("could not parse HEAD commit"));
1514 }
1515 *head = current_head;
1516
1517 return 0;
1518}
1519
1520/*
1521 * Try to commit without forking 'git commit'. In some cases we need

Callers 2

try_to_commitFunction · 0.85
commit_staged_changesFunction · 0.85

Calls 7

repo_get_oidFunction · 0.85
lookup_commit_referenceFunction · 0.85
errorFunction · 0.85
oideqFunction · 0.85
warningFunction · 0.85
oid_to_hexFunction · 0.85
repo_parse_commitFunction · 0.85

Tested by

no test coverage detected