summaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 +0000
committerJeff King <peff@peff.net>2015-11-20 08:02:05 -0500
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /notes-merge.c
parent3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff)
downloadgit-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz
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 'notes-merge.c')
-rw-r--r--notes-merge.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/notes-merge.c b/notes-merge.c
index b3d1dab51f..21e1eb4caa 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -602,15 +602,15 @@ int notes_merge(struct notes_merge_options *o,
if (o->verbosity >= 4)
printf("No merge base found; doing history-less merge\n");
} else if (!bases->next) {
- base_sha1 = bases->item->object.sha1;
- base_tree_sha1 = bases->item->tree->object.sha1;
+ base_sha1 = get_object_hash(bases->item->object);
+ base_tree_sha1 = get_object_hash(bases->item->tree->object);
if (o->verbosity >= 4)
printf("One merge base found (%.7s)\n",
sha1_to_hex(base_sha1));
} else {
/* TODO: How to handle multiple merge-bases? */
- base_sha1 = bases->item->object.sha1;
- base_tree_sha1 = bases->item->tree->object.sha1;
+ base_sha1 = get_object_hash(bases->item->object);
+ base_tree_sha1 = get_object_hash(bases->item->tree->object);
if (o->verbosity >= 3)
printf("Multiple merge bases found. Using the first "
"(%.7s)\n", sha1_to_hex(base_sha1));
@@ -622,23 +622,23 @@ int notes_merge(struct notes_merge_options *o,
sha1_to_hex(local->object.sha1),
sha1_to_hex(base_sha1));
- if (!hashcmp(remote->object.sha1, base_sha1)) {
+ if (!hashcmp(get_object_hash(remote->object), base_sha1)) {
/* Already merged; result == local commit */
if (o->verbosity >= 2)
printf("Already up-to-date!\n");
- hashcpy(result_sha1, local->object.sha1);
+ hashcpy(result_sha1, get_object_hash(local->object));
goto found_result;
}
- if (!hashcmp(local->object.sha1, base_sha1)) {
+ if (!hashcmp(get_object_hash(local->object), base_sha1)) {
/* Fast-forward; result == remote commit */
if (o->verbosity >= 2)
printf("Fast-forward\n");
- hashcpy(result_sha1, remote->object.sha1);
+ hashcpy(result_sha1, get_object_hash(remote->object));
goto found_result;
}
- result = merge_from_diffs(o, base_tree_sha1, local->tree->object.sha1,
- remote->tree->object.sha1, local_tree);
+ result = merge_from_diffs(o, base_tree_sha1, get_object_hash(local->tree->object),
+ get_object_hash(remote->tree->object), local_tree);
if (result != 0) { /* non-trivial merge (with or without conflicts) */
/* Commit (partial) result */