diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2015-11-10 02:22:28 +0000 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2015-11-20 08:02:05 -0500 |
commit | f2fd0760f62e79609fef7bfd7ecebb002e8e4ced (patch) | |
tree | 1f915114b015428730e95a89697783560b672008 /builtin/log.c | |
parent | Add several uses of get_object_hash. (diff) | |
download | tgif-f2fd0760f62e79609fef7bfd7ecebb002e8e4ced.tar.xz |
Convert struct object to object_id
struct object is one of the major data structures dealing with object
IDs. Convert it to use struct object_id instead of an unsigned char
array. Convert get_object_hash to refer to the new member as well.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin/log.c')
-rw-r--r-- | builtin/log.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/builtin/log.c b/builtin/log.c index 0977c8248c..a16ec32434 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -570,7 +570,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) o = parse_object(get_object_hash(*t->tagged)); if (!o) ret = error(_("Could not read object %s"), - sha1_to_hex(t->tagged->sha1)); + oid_to_hex(&t->tagged->oid)); objects[i].item = o; i--; break; @@ -896,8 +896,8 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name) static char *find_branch_name(struct rev_info *rev) { int i, positive = -1; - unsigned char branch_sha1[20]; - const unsigned char *tip_sha1; + struct object_id branch_oid; + const struct object_id *tip_oid; const char *ref, *v; char *full_ref, *branch = NULL; @@ -912,10 +912,10 @@ static char *find_branch_name(struct rev_info *rev) if (positive < 0) return NULL; ref = rev->cmdline.rev[positive].name; - tip_sha1 = rev->cmdline.rev[positive].item->sha1; - if (dwim_ref(ref, strlen(ref), branch_sha1, &full_ref) && + tip_oid = &rev->cmdline.rev[positive].item->oid; + if (dwim_ref(ref, strlen(ref), branch_oid.hash, &full_ref) && skip_prefix(full_ref, "refs/heads/", &v) && - !hashcmp(tip_sha1, branch_sha1)) + !oidcmp(tip_oid, &branch_oid)) branch = xstrdup(v); free(full_ref); return branch; @@ -1443,7 +1443,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) /* Don't say anything if head and upstream are the same. */ if (rev.pending.nr == 2) { struct object_array_entry *o = rev.pending.objects; - if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0) + if (oidcmp(&o[0].item->oid, &o[1].item->oid) == 0) return 0; } get_patch_ids(&rev, &ids); @@ -1550,7 +1550,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) string_list_append(rev.ref_message_ids, rev.message_id); } - gen_message_id(&rev, sha1_to_hex(commit->object.sha1)); + gen_message_id(&rev, oid_to_hex(&commit->object.oid)); } if (!use_stdout && @@ -1675,7 +1675,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) /* Don't say anything if head and upstream are the same. */ if (revs.pending.nr == 2) { struct object_array_entry *o = revs.pending.objects; - if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0) + if (oidcmp(&o[0].item->oid, &o[1].item->oid) == 0) return 0; } |