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>
This commit is contained in:
brian m. carlson
2015-11-10 02:22:28 +00:00
committed by Jeff King
parent 7999b2cf77
commit f2fd0760f6
54 changed files with 256 additions and 256 deletions

View File

@ -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;
}