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

View File

@ -552,7 +552,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
const char *name = objects[i].name;
switch (o->type) {
case OBJ_BLOB:
ret = show_blob_object(o->sha1, &rev, name);
ret = show_blob_object(get_object_hash(*o), &rev, name);
break;
case OBJ_TAG: {
struct tag *t = (struct tag *)o;
@ -563,11 +563,11 @@ int cmd_show(int argc, const char **argv, const char *prefix)
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
ret = show_tag_object(o->sha1, &rev);
ret = show_tag_object(get_object_hash(*o), &rev);
rev.shown_one = 1;
if (ret)
break;
o = parse_object(t->tagged->sha1);
o = parse_object(get_object_hash(*t->tagged));
if (!o)
ret = error(_("Could not read object %s"),
sha1_to_hex(t->tagged->sha1));
@ -830,8 +830,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
o2 = rev->pending.objects[1].item;
flags1 = o1->flags;
flags2 = o2->flags;
c1 = lookup_commit_reference(o1->sha1);
c2 = lookup_commit_reference(o2->sha1);
c1 = lookup_commit_reference(get_object_hash(*o1));
c2 = lookup_commit_reference(get_object_hash(*o2));
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
die(_("Not a range."));
@ -993,8 +993,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
diff_setup_done(&opts);
diff_tree_sha1(origin->tree->object.sha1,
head->tree->object.sha1,
diff_tree_sha1(get_object_hash(origin->tree->object),
get_object_hash(head->tree->object),
"", &opts);
diffcore_std(&opts);
diff_flush(&opts);
@ -1612,12 +1612,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,
{
if (!verbose) {
printf("%c %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev));
find_unique_abbrev(get_object_hash(commit->object), abbrev));
} else {
struct strbuf buf = STRBUF_INIT;
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
printf("%c %s %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev),
find_unique_abbrev(get_object_hash(commit->object), abbrev),
buf.buf);
strbuf_release(&buf);
}