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

Function get_mail_commit_oid

builtin/am.c:1332–1347  ·  view source on GitHub ↗

* Sets commit_id to the commit hash where the mail was generated from. * Returns 0 on success, -1 on failure. */

Source from the content-addressed store, hash-verified

1330 * Returns 0 on success, -1 on failure.
1331 */
1332static int get_mail_commit_oid(struct object_id *commit_id, const char *mail)
1333{
1334 struct strbuf sb = STRBUF_INIT;
1335 FILE *fp = xfopen(mail, "r");
1336 const char *x;
1337 int ret = 0;
1338
1339 if (strbuf_getline_lf(&sb, fp) ||
1340 !skip_prefix(sb.buf, "From ", &x) ||
1341 get_oid_hex(x, commit_id) < 0)
1342 ret = -1;
1343
1344 strbuf_release(&sb);
1345 fclose(fp);
1346 return ret;
1347}
1348
1349/**
1350 * Sets state->msg, state->author_name, state->author_email, state->author_date

Callers 1

parse_mail_rebaseFunction · 0.85

Calls 4

xfopenFunction · 0.85
strbuf_getline_lfFunction · 0.85
get_oid_hexFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected