summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 +0000
committerLibravatar Jeff King <peff@peff.net>2015-11-20 08:02:05 -0500
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /revision.c
parentobject: introduce get_object_hash macro. (diff)
downloadtgif-7999b2cf772956466baa8925491d6fb1b0963292.tar.xz
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 'revision.c')
-rw-r--r--revision.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/revision.c b/revision.c
index 0fbb6841bf..897e9bd0a7 100644
--- a/revision.c
+++ b/revision.c
@@ -282,7 +282,7 @@ static struct commit *handle_commit(struct rev_info *revs,
add_pending_object(revs, object, tag->tag);
if (!tag->tagged)
die("bad tag");
- object = parse_object(tag->tagged->sha1);
+ object = parse_object(get_object_hash(*tag->tagged));
if (!object) {
if (flags & UNINTERESTING)
return NULL;
@@ -510,7 +510,7 @@ static int rev_compare_tree(struct rev_info *revs,
tree_difference = REV_TREE_SAME;
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
- if (diff_tree_sha1(t1->object.sha1, t2->object.sha1, "",
+ if (diff_tree_sha1(get_object_hash(t1->object), get_object_hash(t2->object), "",
&revs->pruning) < 0)
return REV_TREE_DIFFERENT;
return tree_difference;
@@ -526,7 +526,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
tree_difference = REV_TREE_SAME;
DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
- retval = diff_tree_sha1(NULL, t1->object.sha1, "", &revs->pruning);
+ retval = diff_tree_sha1(NULL, get_object_hash(t1->object), "", &revs->pruning);
return retval >= 0 && (tree_difference == REV_TREE_SAME);
}
@@ -1378,7 +1378,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags)
break;
if (!((struct tag*)it)->tagged)
return 0;
- hashcpy(sha1, ((struct tag*)it)->tagged->sha1);
+ hashcpy(sha1, get_object_hash(*((struct tag*)it)->tagged));
}
if (it->type != OBJ_COMMIT)
return 0;
@@ -1555,10 +1555,10 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
a = (a_obj->type == OBJ_COMMIT
? (struct commit *)a_obj
- : lookup_commit_reference(a_obj->sha1));
+ : lookup_commit_reference(get_object_hash(*a_obj)));
b = (b_obj->type == OBJ_COMMIT
? (struct commit *)b_obj
- : lookup_commit_reference(b_obj->sha1));
+ : lookup_commit_reference(get_object_hash(*b_obj)));
if (!a || !b)
goto missing;
exclude = get_merge_bases(a, b);
@@ -2938,7 +2938,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
if (opt->show_notes) {
if (!buf.len)
strbuf_addstr(&buf, message);
- format_display_notes(commit->object.sha1, &buf, encoding, 1);
+ format_display_notes(get_object_hash(commit->object), &buf, encoding, 1);
}
/*
@@ -2968,7 +2968,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
{
if (commit->object.flags & SHOWN)
return commit_ignore;
- if (revs->unpacked && has_sha1_pack(commit->object.sha1))
+ if (revs->unpacked && has_sha1_pack(get_object_hash(commit->object)))
return commit_ignore;
if (revs->show_all)
return commit_show;