summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 (GMT)
committerJeff King <peff@peff.net>2015-11-20 13:02:05 (GMT)
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /sequencer.c
parent3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff)
downloadgit-7999b2cf772956466baa8925491d6fb1b0963292.zip
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.bz2
Add several uses of get_object_hash.
Convert most instances where the sha1 member of struct object is dereferenced to use get_object_hash. Most instances that are passed to functions that have versions taking struct object_id, such as get_sha1_hex/get_oid_hex, or instances that can be trivially converted to use struct object_id instead, are not converted. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sequencer.c b/sequencer.c
index a0600ae..968c1a5 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -346,7 +346,7 @@ static int is_index_unchanged(void)
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, get_object_hash(head_commit->tree->object));
}
/*
@@ -403,12 +403,12 @@ static int is_original_commit_empty(struct commit *commit)
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;
+ ptree_sha1 = get_object_hash(parent->tree->object);
} else {
ptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */
}
- return !hashcmp(ptree_sha1, commit->tree->object.sha1);
+ return !hashcmp(ptree_sha1, get_object_hash(commit->tree->object));
}
/*
@@ -503,9 +503,9 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
parent = commit->parents->item;
if (opts->allow_ff &&
- ((parent && !hashcmp(parent->object.sha1, head)) ||
+ ((parent && !hashcmp(get_object_hash(parent->object), head)) ||
(!parent && unborn)))
- return fast_forward_to(commit->object.sha1, head, unborn, opts);
+ return fast_forward_to(get_object_hash(commit->object), head, unborn, opts);
if (parent && parse_commit(parent) < 0)
/* TRANSLATORS: The first %s will be "revert" or
@@ -592,17 +592,17 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
* 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", get_object_hash(commit->object), 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", get_object_hash(commit->object), 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(get_object_hash(commit->object), DEFAULT_ABBREV),
msg.subject);
print_advice(res == 1, opts);
rerere(opts->allow_rerere_auto);
@@ -664,7 +664,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
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(get_object_hash(cur->item->object), DEFAULT_ABBREV);
subject_len = find_commit_subject(commit_buffer, &subject);
strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
subject_len, subject);