git_commit_encoding = "UTF-8";
out->message = logmsg_reencode(commit, NULL, git_commit_encoding);
- abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
+ abbrev = find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV);
abbrev_len = strlen(abbrev);
subject_len = find_commit_subject(out->message, &subject);
if (cache_tree_update(&the_index, 0))
return error(_("Unable to update cache tree\n"));
- return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.sha1);
+ return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.oid.hash);
}
/*
if (parse_commit(commit))
return error(_("Could not parse commit %s\n"),
- sha1_to_hex(commit->object.sha1));
+ oid_to_hex(&commit->object.oid));
if (commit->parents) {
struct commit *parent = commit->parents->item;
if (parse_commit(parent))
return error(_("Could not parse parent commit %s\n"),
- sha1_to_hex(parent->object.sha1));
- ptree_sha1 = parent->tree->object.sha1;
+ oid_to_hex(&parent->object.oid));
+ ptree_sha1 = parent->tree->object.oid.hash;
} else {
ptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */
}
- return !hashcmp(ptree_sha1, commit->tree->object.sha1);
+ return !hashcmp(ptree_sha1, commit->tree->object.oid.hash);
}
/*
if (!opts->mainline)
return error(_("Commit %s is a merge but no -m option was given."),
- sha1_to_hex(commit->object.sha1));
+ oid_to_hex(&commit->object.oid));
for (cnt = 1, p = commit->parents;
cnt != opts->mainline && p;
p = p->next;
if (cnt != opts->mainline || !p)
return error(_("Commit %s does not have parent %d"),
- sha1_to_hex(commit->object.sha1), opts->mainline);
+ oid_to_hex(&commit->object.oid), opts->mainline);
parent = p->item;
} else if (0 < opts->mainline)
return error(_("Mainline was specified but commit %s is not a merge."),
- sha1_to_hex(commit->object.sha1));
+ oid_to_hex(&commit->object.oid));
else
parent = commit->parents->item;
if (opts->allow_ff &&
- ((parent && !hashcmp(parent->object.sha1, head)) ||
+ ((parent && !hashcmp(parent->object.oid.hash, head)) ||
(!parent && unborn)))
- return fast_forward_to(commit->object.sha1, head, unborn, opts);
+ return fast_forward_to(commit->object.oid.hash, head, unborn, opts);
if (parent && parse_commit(parent) < 0)
/* TRANSLATORS: The first %s will be "revert" or
"cherry-pick", the second %s a SHA1 */
return error(_("%s: cannot parse parent commit %s"),
- action_name(opts), sha1_to_hex(parent->object.sha1));
+ action_name(opts), oid_to_hex(&parent->object.oid));
if (get_message(commit, &msg) != 0)
return error(_("Cannot get commit message for %s"),
- sha1_to_hex(commit->object.sha1));
+ oid_to_hex(&commit->object.oid));
/*
* "commit" is an existing commit. We would want to apply
strbuf_addstr(&msgbuf, "Revert \"");
strbuf_addstr(&msgbuf, msg.subject);
strbuf_addstr(&msgbuf, "\"\n\nThis reverts commit ");
- strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
+ strbuf_addstr(&msgbuf, oid_to_hex(&commit->object.oid));
if (commit->parents && commit->parents->next) {
strbuf_addstr(&msgbuf, ", reversing\nchanges made to ");
- strbuf_addstr(&msgbuf, sha1_to_hex(parent->object.sha1));
+ strbuf_addstr(&msgbuf, oid_to_hex(&parent->object.oid));
}
strbuf_addstr(&msgbuf, ".\n");
} else {
if (!has_conforming_footer(&msgbuf, NULL, 0))
strbuf_addch(&msgbuf, '\n');
strbuf_addstr(&msgbuf, cherry_picked_prefix);
- strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
+ strbuf_addstr(&msgbuf, oid_to_hex(&commit->object.oid));
strbuf_addstr(&msgbuf, ")\n");
}
}
* write it at all.
*/
if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
- update_ref(NULL, "CHERRY_PICK_HEAD", commit->object.sha1, NULL,
+ update_ref(NULL, "CHERRY_PICK_HEAD", commit->object.oid.hash, NULL,
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
if (opts->action == REPLAY_REVERT && ((opts->no_commit && res == 0) || res == 1))
- update_ref(NULL, "REVERT_HEAD", commit->object.sha1, NULL,
+ update_ref(NULL, "REVERT_HEAD", commit->object.oid.hash, NULL,
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
if (res) {
error(opts->action == REPLAY_REVERT
? _("could not revert %s... %s")
: _("could not apply %s... %s"),
- find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
+ find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV),
msg.subject);
print_advice(res == 1, opts);
rerere(opts->allow_rerere_auto);
for (cur = todo_list; cur; cur = cur->next) {
const char *commit_buffer = get_commit_buffer(cur->item, NULL);
- sha1_abbrev = find_unique_abbrev(cur->item->object.sha1, DEFAULT_ABBREV);
+ sha1_abbrev = find_unique_abbrev(cur->item->object.oid.hash, DEFAULT_ABBREV);
subject_len = find_commit_subject(commit_buffer, &subject);
strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
subject_len, subject);