aboutsummaryrefslogtreecommitdiffstats
path: root/log-tree.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 /log-tree.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 'log-tree.c')
-rw-r--r--log-tree.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/log-tree.c b/log-tree.c
index 7b1b57aaf6..947c099f2a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -133,7 +133,7 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
if (!obj)
break;
if (!obj->parsed)
- parse_object(obj->sha1);
+ parse_object(get_object_hash(*obj));
add_name_decoration(DECORATION_REF_TAG, refname, obj);
}
return 0;
@@ -165,7 +165,7 @@ static void show_parents(struct commit *commit, int abbrev)
struct commit_list *p;
for (p = commit->parents; p ; p = p->next) {
struct commit *parent = p->item;
- printf(" %s", find_unique_abbrev(parent->object.sha1, abbrev));
+ printf(" %s", find_unique_abbrev(get_object_hash(parent->object), abbrev));
}
}
@@ -173,7 +173,7 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
{
struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
for ( ; p; p = p->next) {
- printf(" %s", find_unique_abbrev(p->item->object.sha1, abbrev));
+ printf(" %s", find_unique_abbrev(get_object_hash(p->item->object), abbrev));
}
}
@@ -469,7 +469,7 @@ static int which_parent(const unsigned char *sha1, const struct commit *commit)
const struct commit_list *parent;
for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
- if (!hashcmp(parent->item->object.sha1, sha1))
+ if (!hashcmp(get_object_hash(parent->item->object), sha1))
return nth;
nth++;
}
@@ -507,9 +507,9 @@ static void show_one_mergetag(struct commit *commit,
commit->parents->next->item->object.sha1))
strbuf_addf(&verify_message,
"merged tag '%s'\n", tag->tag);
- else if ((nth = which_parent(tag->tagged->sha1, commit)) < 0)
+ else if ((nth = which_parent(get_object_hash(*tag->tagged), commit)) < 0)
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
- tag->tag, tag->tagged->sha1);
+ tag->tag, get_object_hash(*tag->tagged));
else
strbuf_addf(&verify_message,
"parent #%d, tagged '%s'\n", nth + 1, tag->tag);
@@ -553,7 +553,7 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
- fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
+ fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit), stdout);
if (opt->print_parents)
show_parents(commit, abbrev_commit);
if (opt->children.name)
@@ -613,7 +613,7 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
- fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit),
+ fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit),
stdout);
if (opt->print_parents)
show_parents(commit, abbrev_commit);
@@ -621,7 +621,7 @@ void show_log(struct rev_info *opt)
show_children(opt, commit, abbrev_commit);
if (parent)
printf(" (from %s)",
- find_unique_abbrev(parent->object.sha1,
+ find_unique_abbrev(get_object_hash(parent->object),
abbrev_commit));
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), stdout);
show_decorations(opt, commit);
@@ -660,7 +660,7 @@ void show_log(struct rev_info *opt)
struct strbuf notebuf = STRBUF_INIT;
raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
- format_display_notes(commit->object.sha1, &notebuf,
+ format_display_notes(get_object_hash(commit->object), &notebuf,
get_log_output_encoding(), raw);
ctx.notes_message = notebuf.len
? strbuf_detach(&notebuf, NULL)