Remove get_object_hash.

Convert all instances of get_object_hash to use an appropriate reference to the hash member of the oid member of struct object. This provides no functional change, as it is essentially a macro substitution. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>

brian m. carlson committed Nov 10, 2015 at 02:22 UTC ed1c9977cb1b63e4270ad8bdf967a2d02580aa08
63 files changed +251 -253
archive.c
+3 -3
@@ -241,7 +241,7 @@ int write_archive_entries(struct archiver_args *args,
241 len--;
242 if (args->verbose)
243 fprintf(stderr, "%.*s\n", (int)len, args->base);
244 - err = write_entry(args, get_object_hash(args->tree->object), args->base,
244 + err = write_entry(args, args->tree->object.oid.hash, args->base,
245 len, 040777);
246 if (err)
247 return err;
@@ -374,7 +374,7 @@ static void parse_treeish_arg(const char **argv,
374
375 commit = lookup_commit_reference_gently(oid.hash, 1);
376 if (commit) {
377 - commit_sha1 = get_object_hash(commit->object);
377 + commit_sha1 = commit->object.oid.hash;
378 archive_time = commit->date;
379 } else {
380 commit_sha1 = NULL;
@@ -390,7 +390,7 @@ static void parse_treeish_arg(const char **argv,
390 unsigned int mode;
391 int err;
392
393 - err = get_tree_entry(get_object_hash(tree->object), prefix,
393 + err = get_tree_entry(tree->object.oid.hash, prefix,
394 tree_oid.hash, &mode);
395 if (err || !S_ISDIR(mode))
396 die("current working directory is untracked");
bisect.c
+3 -3
@@ -500,7 +500,7 @@ struct commit_list *filter_skipped(struct commit_list *list,
500 struct commit_list *next = list->next;
501 list->next = NULL;
502 if (0 <= sha1_array_lookup(&skipped_revs,
503 - get_object_hash(list->item->object))) {
503 + list->item->object.oid.hash)) {
504 if (skipped_first && !*skipped_first)
505 *skipped_first = 1;
506 /* Move current to tried list */
@@ -784,7 +784,7 @@ static void check_merge_bases(int no_checkout)
784 result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
785
786 for (; result; result = result->next) {
787 - const unsigned char *mb = get_object_hash(result->item->object);
787 + const unsigned char *mb = result->item->object.oid.hash;
788 if (!hashcmp(mb, current_bad_oid->hash)) {
789 handle_bad_merge_base();
790 } else if (0 <= sha1_array_lookup(&good_revs, mb)) {
@@ -973,7 +973,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
973 exit(4);
974 }
975
976 - bisect_rev = get_object_hash(revs.commits->item->object);
976 + bisect_rev = revs.commits->item->object.oid.hash;
977
978 if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
979 exit_if_skipped_commits(tried, current_bad_oid);
branch.c
+1 -1
@@ -267,7 +267,7 @@ void create_branch(const char *head,
267
268 if ((commit = lookup_commit_reference(sha1)) == NULL)
269 die(_("Not a valid branch point: '%s'."), start_name);
270 - hashcpy(sha1, get_object_hash(commit->object));
270 + hashcpy(sha1, commit->object.oid.hash);
271
272 if (forcing)
273 snprintf(msg, sizeof msg, "branch: Reset to %s",
builtin/blame.c
+12 -12
@@ -506,7 +506,7 @@ static int fill_blob_sha1_and_mode(struct origin *origin)
506 {
507 if (!is_null_sha1(origin->blob_sha1))
508 return 0;
509 - if (get_tree_entry(get_object_hash(origin->commit->object),
509 + if (get_tree_entry(origin->commit->object.oid.hash,
510 origin->path,
511 origin->blob_sha1, &origin->mode))
512 goto error_out;
@@ -558,10 +558,10 @@ static struct origin *find_origin(struct scoreboard *sb,
558 diff_setup_done(&diff_opts);
559
560 if (is_null_oid(&origin->commit->object.oid))
561 - do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
561 + do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
562 else
563 - diff_tree_sha1(get_object_hash(parent->tree->object),
564 - get_object_hash(origin->commit->tree->object),
563 + diff_tree_sha1(parent->tree->object.oid.hash,
564 + origin->commit->tree->object.oid.hash,
565 "", &diff_opts);
566 diffcore_std(&diff_opts);
567
@@ -628,10 +628,10 @@ static struct origin *find_rename(struct scoreboard *sb,
628 diff_setup_done(&diff_opts);
629
630 if (is_null_oid(&origin->commit->object.oid))
631 - do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
631 + do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
632 else
633 - diff_tree_sha1(get_object_hash(parent->tree->object),
634 - get_object_hash(origin->commit->tree->object),
633 + diff_tree_sha1(parent->tree->object.oid.hash,
634 + origin->commit->tree->object.oid.hash,
635 "", &diff_opts);
636 diffcore_std(&diff_opts);
637
@@ -1276,10 +1276,10 @@ static void find_copy_in_parent(struct scoreboard *sb,
1276 DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
1277
1278 if (is_null_oid(&target->commit->object.oid))
1279 - do_diff_cache(get_object_hash(parent->tree->object), &diff_opts);
1279 + do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
1280 else
1281 - diff_tree_sha1(get_object_hash(parent->tree->object),
1282 - get_object_hash(target->commit->tree->object),
1281 + diff_tree_sha1(parent->tree->object.oid.hash,
1282 + target->commit->tree->object.oid.hash,
1283 "", &diff_opts);
1284
1285 if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
@@ -2077,7 +2077,7 @@ static int read_ancestry(const char *graft_file)
2077
2078 static int update_auto_abbrev(int auto_abbrev, struct origin *suspect)
2079 {
2080 - const char *uniq = find_unique_abbrev(get_object_hash(suspect->commit->object),
2080 + const char *uniq = find_unique_abbrev(suspect->commit->object.oid.hash,
2081 auto_abbrev);
2082 int len = strlen(uniq);
2083 if (auto_abbrev < len)
@@ -2216,7 +2216,7 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
2216 struct commit_list *parents;
2217
2218 for (parents = work_tree->parents; parents; parents = parents->next) {
2219 - const unsigned char *commit_sha1 = get_object_hash(parents->item->object);
2219 + const unsigned char *commit_sha1 = parents->item->object.oid.hash;
2220 unsigned char blob_sha1[20];
2221 unsigned mode;
2222
builtin/branch.c
+1 -1
@@ -349,7 +349,7 @@ static void add_verbose_info(struct strbuf *out, struct ref_array_item *item,
349 fill_tracking_info(&stat, refname, filter->verbose > 1);
350
351 strbuf_addf(out, " %s %s%s",
352 - find_unique_abbrev(get_object_hash(item->commit->object), filter->abbrev),
352 + find_unique_abbrev(item->commit->object.oid.hash, filter->abbrev),
353 stat.buf, sub);
354 strbuf_release(&stat);
355 strbuf_release(&subject);
builtin/checkout.c
+5 -5
@@ -401,7 +401,7 @@ static void describe_detached_head(const char *msg, struct commit *commit)
401 if (!parse_commit(commit))
402 pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
403 fprintf(stderr, "%s %s... %s\n", msg,
404 - find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV), sb.buf);
404 + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
405 strbuf_release(&sb);
406 }
407
@@ -510,7 +510,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
510 setup_standard_excludes(topts.dir);
511 }
512 tree = parse_tree_indirect(old->commit ?
513 - get_object_hash(old->commit->object) :
513 + old->commit->object.oid.hash :
514 EMPTY_TREE_SHA1_BIN);
515 init_tree_desc(&trees[0], tree->buffer, tree->size);
516 tree = parse_tree_indirect(new->commit->object.oid.hash);
@@ -653,7 +653,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
653 if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
654 /* Nothing to do. */
655 } else if (opts->force_detach || !new->path) { /* No longer on any branch. */
656 - update_ref(msg.buf, "HEAD", get_object_hash(new->commit->object), NULL,
656 + update_ref(msg.buf, "HEAD", new->commit->object.oid.hash, NULL,
657 REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
658 if (!opts->quiet) {
659 if (old->path && advice_detached_head)
@@ -704,7 +704,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
704 {
705 strbuf_addstr(sb, " ");
706 strbuf_addstr(sb,
707 - find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
707 + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
708 strbuf_addch(sb, ' ');
709 if (!parse_commit(commit))
710 pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
@@ -762,7 +762,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
762 " git branch <new-branch-name> %s\n\n",
763 /* Give ngettext() the count */
764 lost),
765 - find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
765 + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
766 }
767
768 /*
builtin/clone.c
+1 -1
@@ -657,7 +657,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
657 } else if (our) {
658 struct commit *c = lookup_commit_reference(our->old_oid.hash);
659 /* --branch specifies a non-branch (i.e. tags), detach HEAD */
660 - update_ref(msg, "HEAD", get_object_hash(c->object),
660 + update_ref(msg, "HEAD", c->object.oid.hash,
661 NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
662 } else if (remote) {
663 /*
builtin/commit.c
+4 -4
@@ -299,7 +299,7 @@ static void create_base_index(const struct commit *current_head)
299 opts.dst_index = &the_index;
300
301 opts.fn = oneway_merge;
302 - tree = parse_tree_indirect(get_object_hash(current_head->object));
302 + tree = parse_tree_indirect(current_head->object.oid.hash);
303 if (!tree)
304 die(_("failed to unpack HEAD tree object"));
305 parse_tree(tree);
@@ -1766,7 +1766,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1766 if (!transaction ||
1767 ref_transaction_update(transaction, "HEAD", sha1,
1768 current_head
1769 - ? get_object_hash(current_head->object) : null_sha1,
1769 + ? current_head->object.oid.hash : null_sha1,
1770 0, sb.buf, &err) ||
1771 ref_transaction_commit(transaction, &err)) {
1772 rollback_index_files();
@@ -1793,10 +1793,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1793 cfg = init_copy_notes_for_rewrite("amend");
1794 if (cfg) {
1795 /* we are amending, so current_head is not NULL */
1796 - copy_note_for_rewrite(cfg, get_object_hash(current_head->object), sha1);
1796 + copy_note_for_rewrite(cfg, current_head->object.oid.hash, sha1);
1797 finish_copy_notes_for_rewrite(cfg, "Notes added by 'git commit --amend'");
1798 }
1799 - run_rewrite_hook(get_object_hash(current_head->object), sha1);
1799 + run_rewrite_hook(current_head->object.oid.hash, sha1);
1800 }
1801 if (!quiet)
1802 print_summary(prefix, sha1, !current_head);
builtin/describe.c
+3 -3
@@ -252,14 +252,14 @@ static void describe(const char *arg, int last_one)
252 if (!cmit)
253 die(_("%s is not a valid '%s' object"), arg, commit_type);
254
255 - n = find_commit_name(get_object_hash(cmit->object));
255 + n = find_commit_name(cmit->object.oid.hash);
256 if (n && (tags || all || n->prio == 2)) {
257 /*
258 * Exact match to an existing ref.
259 */
260 display_name(n);
261 if (longformat)
262 - show_suffix(0, n->tag ? get_object_hash(*n->tag->tagged) : sha1);
262 + show_suffix(0, n->tag ? n->tag->tagged->oid.hash : sha1);
263 if (dirty)
264 printf("%s", dirty);
265 printf("\n");
@@ -380,7 +380,7 @@ static void describe(const char *arg, int last_one)
380
381 display_name(all_matches[0].name);
382 if (abbrev)
383 - show_suffix(all_matches[0].depth, get_object_hash(cmit->object));
383 + show_suffix(all_matches[0].depth, cmit->object.oid.hash);
384 if (dirty)
385 printf("%s", dirty);
386 printf("\n");
builtin/diff-tree.c
+4 -4
@@ -51,7 +51,7 @@ static int stdin_diff_trees(struct tree *tree1, char *line, int len)
51 return -1;
52 printf("%s %s\n", oid_to_hex(&tree1->object.oid),
53 oid_to_hex(&tree2->object.oid));
54 - diff_tree_sha1(get_object_hash(tree1->object), get_object_hash(tree2->object),
54 + diff_tree_sha1(tree1->object.oid.hash, tree2->object.oid.hash,
55 "", &log_tree_opt.diffopt);
56 log_tree_diff_flush(&log_tree_opt);
57 return 0;
@@ -139,7 +139,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
139 break;
140 case 1:
141 tree1 = opt->pending.objects[0].item;
142 - diff_tree_commit_sha1(get_object_hash(*tree1));
142 + diff_tree_commit_sha1(tree1->oid.hash);
143 break;
144 case 2:
145 tree1 = opt->pending.objects[0].item;
@@ -149,8 +149,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
149 tree2 = tree1;
150 tree1 = tmp;
151 }
152 - diff_tree_sha1(get_object_hash(*tree1),
153 - get_object_hash(*tree2),
152 + diff_tree_sha1(tree1->oid.hash,
153 + tree2->oid.hash,
154 "", &opt->diffopt);
155 log_tree_diff_flush(opt);
156 break;
builtin/diff.c
+6 -6
@@ -175,8 +175,8 @@ static int builtin_diff_tree(struct rev_info *revs,
175 */
176 if (ent1->item->flags & UNINTERESTING)
177 swap = 1;
178 - sha1[swap] = get_object_hash(*ent0->item);
179 - sha1[1 - swap] = get_object_hash(*ent1->item);
178 + sha1[swap] = ent0->item->oid.hash;
179 + sha1[1 - swap] = ent1->item->oid.hash;
180 diff_tree_sha1(sha1[0], sha1[1], "", &revs->diffopt);
181 log_tree_diff_flush(revs);
182 return 0;
@@ -196,8 +196,8 @@ static int builtin_diff_combined(struct rev_info *revs,
196 if (!revs->dense_combined_merges && !revs->combine_merges)
197 revs->dense_combined_merges = revs->combine_merges = 1;
198 for (i = 1; i < ents; i++)
199 - sha1_array_append(&parents, get_object_hash(*ent[i].item));
200 - diff_tree_combined(get_object_hash(*ent[0].item), &parents,
199 + sha1_array_append(&parents, ent[i].item->oid.hash);
200 + diff_tree_combined(ent[0].item->oid.hash, &parents,
201 revs->dense_combined_merges, revs);
202 sha1_array_clear(&parents);
203 return 0;
@@ -395,7 +395,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
395 const char *name = entry->name;
396 int flags = (obj->flags & UNINTERESTING);
397 if (!obj->parsed)
398 - obj = parse_object(get_object_hash(*obj));
398 + obj = parse_object(obj->oid.hash);
399 obj = deref_tag(obj, NULL, 0);
400 if (!obj)
401 die(_("invalid object '%s' given."), name);
@@ -408,7 +408,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
408 } else if (obj->type == OBJ_BLOB) {
409 if (2 <= blobs)
410 die(_("more than two blobs given: '%s'"), name);
411 - hashcpy(blob[blobs].sha1, get_object_hash(*obj));
411 + hashcpy(blob[blobs].sha1, obj->oid.hash);
412 blob[blobs].name = name;
413 blob[blobs].mode = entry->mode;
414 blobs++;
builtin/fast-export.c
+6 -6
@@ -562,11 +562,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
562 get_object_mark(&commit->parents->item->object) != 0 &&
563 !full_tree) {
564 parse_commit_or_die(commit->parents->item);
565 - diff_tree_sha1(get_object_hash(commit->parents->item->tree->object),
566 - get_object_hash(commit->tree->object), "", &rev->diffopt);
565 + diff_tree_sha1(commit->parents->item->tree->object.oid.hash,
566 + commit->tree->object.oid.hash, "", &rev->diffopt);
567 }
568 else
569 - diff_root_tree_sha1(get_object_hash(commit->tree->object),
569 + diff_root_tree_sha1(commit->tree->object.oid.hash,
570 "", &rev->diffopt);
571
572 /* Export the referenced blobs, and remember the marks. */
@@ -665,7 +665,7 @@ static void handle_tag(const char *name, struct tag *tag)
665 return;
666 }
667
668 - buf = read_sha1_file(get_object_hash(tag->object), &type, &size);
668 + buf = read_sha1_file(tag->object.oid.hash, &type, &size);
669 if (!buf)
670 die ("Could not read tag %s", oid_to_hex(&tag->object.oid));
671 message = memmem(buf, size, "\n\n", 2);
@@ -777,7 +777,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
777
778 /* handle nested tags */
779 while (tag && tag->object.type == OBJ_TAG) {
780 - parse_object(get_object_hash(tag->object));
780 + parse_object(tag->object.oid.hash);
781 string_list_append(&extra_refs, full_name)->util = tag;
782 tag = (struct tag *)tag->tagged;
783 }
@@ -828,7 +828,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
828 case OBJ_COMMIT:
829 break;
830 case OBJ_BLOB:
831 - export_blob(get_object_hash(commit->object));
831 + export_blob(commit->object.oid.hash);
832 continue;
833 default: /* OBJ_TAG (nested tags) is already handled */
834 warning("Tag points to object of unexpected type %s, skipping.",
builtin/fetch.c
+2 -2
@@ -530,7 +530,7 @@ static int update_local_ref(struct ref *ref,
530 if (in_merge_bases(current, updated)) {
531 struct strbuf quickref = STRBUF_INIT;
532 int r;
533 - strbuf_add_unique_abbrev(&quickref, get_object_hash(current->object), DEFAULT_ABBREV);
533 + strbuf_add_unique_abbrev(&quickref, current->object.oid.hash, DEFAULT_ABBREV);
534 strbuf_addstr(&quickref, "..");
535 strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
536 if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
@@ -547,7 +547,7 @@ static int update_local_ref(struct ref *ref,
547 } else if (force || ref->force) {
548 struct strbuf quickref = STRBUF_INIT;
549 int r;
550 - strbuf_add_unique_abbrev(&quickref, get_object_hash(current->object), DEFAULT_ABBREV);
550 + strbuf_add_unique_abbrev(&quickref, current->object.oid.hash, DEFAULT_ABBREV);
551 strbuf_addstr(&quickref, "...");
552 strbuf_add_unique_abbrev(&quickref, ref->new_oid.hash, DEFAULT_ABBREV);
553 if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
builtin/fmt-merge-msg.c
+2 -2
@@ -568,7 +568,7 @@ static void find_merge_parents(struct merge_parents *result,
568 if (!parent)
569 continue;
570 commit_list_insert(parent, &parents);
571 - add_merge_parent(result, get_object_hash(*obj), get_object_hash(parent->object));
571 + add_merge_parent(result, obj->oid.hash, parent->object.oid.hash);
572 }
573 head_commit = lookup_commit(head);
574 if (head_commit)
@@ -578,7 +578,7 @@ static void find_merge_parents(struct merge_parents *result,
578 while (parents) {
579 struct commit *cmit = pop_commit(&parents);
580 for (i = 0; i < result->nr; i++)
581 - if (!hashcmp(result->item[i].commit, get_object_hash(cmit->object)))
581 + if (!hashcmp(result->item[i].commit, cmit->object.oid.hash))
582 result->item[i].used = 1;
583 }
584
builtin/fsck.c
+2 -2
@@ -186,7 +186,7 @@ static void check_reachable_object(struct object *obj)
186 * do a full fsck
187 */
188 if (!(obj->flags & HAS_OBJ)) {
189 - if (has_sha1_pack(get_object_hash(*obj)))
189 + if (has_sha1_pack(obj->oid.hash))
190 return; /* it is in pack - forget about it */
191 if (connectivity_only && has_object_file(&obj->oid))
192 return;
@@ -249,7 +249,7 @@ static void check_unreachable_object(struct object *obj)
249 if (!(f = fopen(filename, "w")))
250 die_errno("Could not open '%s'", filename);
251 if (obj->type == OBJ_BLOB) {
252 - if (stream_blob_to_fd(fileno(f), get_object_hash(*obj), NULL, 1))
252 + if (stream_blob_to_fd(fileno(f), obj->oid.hash, NULL, 1))
253 die_errno("Could not write '%s'", filename);
254 } else
255 fprintf(f, "%s\n", oid_to_hex(&obj->oid));
builtin/grep.c
+1 -1
@@ -459,7 +459,7 @@ static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
459 struct object *obj, const char *name, const char *path)
460 {
461 if (obj->type == OBJ_BLOB)
462 - return grep_sha1(opt, get_object_hash(*obj), name, 0, path);
462 + return grep_sha1(opt, obj->oid.hash, name, 0, path);
463 if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
464 struct tree_desc tree;
465 void *data;
builtin/index-pack.c
+1 -1
@@ -217,7 +217,7 @@ static unsigned check_object(struct object *obj)
217
218 if (!(obj->flags & FLAG_CHECKED)) {
219 unsigned long size;
220 - int type = sha1_object_info(get_object_hash(*obj), &size);
220 + int type = sha1_object_info(obj->oid.hash, &size);
221 if (type <= 0)
222 die(_("did not receive expected object %s"),
223 oid_to_hex(&obj->oid));
builtin/log.c
+9 -9
@@ -552,7 +552,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
552 const char *name = objects[i].name;
553 switch (o->type) {
554 case OBJ_BLOB:
555 - ret = show_blob_object(get_object_hash(*o), &rev, name);
555 + ret = show_blob_object(o->oid.hash, &rev, name);
556 break;
557 case OBJ_TAG: {
558 struct tag *t = (struct tag *)o;
@@ -563,11 +563,11 @@ int cmd_show(int argc, const char **argv, const char *prefix)
563 diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
564 t->tag,
565 diff_get_color_opt(&rev.diffopt, DIFF_RESET));
566 - ret = show_tag_object(get_object_hash(*o), &rev);
566 + ret = show_tag_object(o->oid.hash, &rev);
567 rev.shown_one = 1;
568 if (ret)
569 break;
570 - o = parse_object(get_object_hash(*t->tagged));
570 + o = parse_object(t->tagged->oid.hash);
571 if (!o)
572 ret = error(_("Could not read object %s"),
573 oid_to_hex(&t->tagged->oid));
@@ -830,8 +830,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
830 o2 = rev->pending.objects[1].item;
831 flags1 = o1->flags;
832 flags2 = o2->flags;
833 - c1 = lookup_commit_reference(get_object_hash(*o1));
834 - c2 = lookup_commit_reference(get_object_hash(*o2));
833 + c1 = lookup_commit_reference(o1->oid.hash);
834 + c2 = lookup_commit_reference(o2->oid.hash);
835
836 if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
837 die(_("Not a range."));
@@ -993,8 +993,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
993
994 diff_setup_done(&opts);
995
996 - diff_tree_sha1(get_object_hash(origin->tree->object),
997 - get_object_hash(head->tree->object),
996 + diff_tree_sha1(origin->tree->object.oid.hash,
997 + head->tree->object.oid.hash,
998 "", &opts);
999 diffcore_std(&opts);
1000 diff_flush(&opts);
@@ -1612,12 +1612,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,
1612 {
1613 if (!verbose) {
1614 printf("%c %s\n", sign,
1615 - find_unique_abbrev(get_object_hash(commit->object), abbrev));
1615 + find_unique_abbrev(commit->object.oid.hash, abbrev));
1616 } else {
1617 struct strbuf buf = STRBUF_INIT;
1618 pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
1619 printf("%c %s %s\n", sign,
1620 - find_unique_abbrev(get_object_hash(commit->object), abbrev),
1620 + find_unique_abbrev(commit->object.oid.hash, abbrev),
1621 buf.buf);
1622 strbuf_release(&buf);
1623 }
builtin/merge-tree.c
+2 -2
@@ -60,7 +60,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
60 const char *path = entry->path;
61
62 if (!entry->stage)
63 - return read_sha1_file(get_object_hash(entry->blob->object), &type, size);
63 + return read_sha1_file(entry->blob->object.oid.hash, &type, size);
64 base = NULL;
65 if (entry->stage == 1) {
66 base = entry->blob;
@@ -82,7 +82,7 @@ static void *origin(struct merge_list *entry, unsigned long *size)
82 enum object_type type;
83 while (entry) {
84 if (entry->stage == 2)
85 - return read_sha1_file(get_object_hash(entry->blob->object), &type, size);
85 + return read_sha1_file(entry->blob->object.oid.hash, &type, size);
86 entry = entry->link;
87 }
88 return NULL;
builtin/merge.c
+25 -25
@@ -380,7 +380,7 @@ static void finish(struct commit *head_commit,
380 const unsigned char *new_head, const char *msg)
381 {
382 struct strbuf reflog_message = STRBUF_INIT;
383 - const unsigned char *head = get_object_hash(head_commit->object);
383 + const unsigned char *head = head_commit->object.oid.hash;
384
385 if (!msg)
386 strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
@@ -497,7 +497,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
497 if (ref_exists(truname.buf)) {
498 strbuf_addf(msg,
499 "%s\t\tbranch '%s'%s of .\n",
500 - sha1_to_hex(get_object_hash(remote_head->object)),
500 + sha1_to_hex(remote_head->object.oid.hash),
501 truname.buf + 11,
502 (early ? " (early part)" : ""));
503 strbuf_release(&truname);
@@ -511,7 +511,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
511 desc = merge_remote_util(remote_head);
512 if (desc && desc->obj && desc->obj->type == OBJ_TAG) {
513 strbuf_addf(msg, "%s\t\t%s '%s'\n",
514 - sha1_to_hex(get_object_hash(*desc->obj)),
514 + sha1_to_hex(desc->obj->oid.hash),
515 typename(desc->obj->type),
516 remote);
517 goto cleanup;
@@ -519,7 +519,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
519 }
520
521 strbuf_addf(msg, "%s\t\tcommit '%s'\n",
522 - sha1_to_hex(get_object_hash(remote_head->object)), remote);
522 + sha1_to_hex(remote_head->object.oid.hash), remote);
523 cleanup:
524 strbuf_release(&buf);
525 strbuf_release(&bname);
@@ -892,7 +892,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv,
892 second_token = lookup_commit_reference_gently(second_sha1, 0);
893 if (!second_token)
894 die(_("'%s' is not a commit"), argv[1]);
895 - if (hashcmp(get_object_hash(second_token->object), head))
895 + if (hashcmp(second_token->object.oid.hash, head))
896 return NULL;
897 }
898 return second_token;
@@ -1274,8 +1274,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1274 die(_("%s - not something we can merge"), argv[0]);
1275 if (remoteheads->next)
1276 die(_("Can merge only exactly one commit into empty head"));
1277 - read_empty(get_object_hash(remote_head->object), 0);
1278 - update_ref("initial pull", "HEAD", get_object_hash(remote_head->object),
1277 + read_empty(remote_head->object.oid.hash, 0);
1278 + update_ref("initial pull", "HEAD", remote_head->object.oid.hash,
1279 NULL, 0, UPDATE_REFS_DIE_ON_ERR);
1280 goto done;
1281 }
@@ -1289,7 +1289,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1289 * additional safety measure to check for it.
1290 */
1291 if (!have_message &&
1292 - is_old_style_invocation(argc, argv, get_object_hash(head_commit->object))) {
1292 + is_old_style_invocation(argc, argv, head_commit->object.oid.hash)) {
1293 warning("old-style 'git merge <msg> HEAD <commit>' is deprecated.");
1294 strbuf_addstr(&merge_msg, argv[0]);
1295 head_arg = argv[1];
@@ -1323,7 +1323,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1323
1324 check_commit_signature(commit, &signature_check);
1325
1326 - find_unique_abbrev_r(hex, get_object_hash(commit->object), DEFAULT_ABBREV);
1326 + find_unique_abbrev_r(hex, commit->object.oid.hash, DEFAULT_ABBREV);
1327 switch (signature_check.result) {
1328 case 'G':
1329 break;
@@ -1353,7 +1353,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1353 for (p = remoteheads; p; p = p->next) {
1354 struct commit *commit = p->item;
1355 strbuf_addf(&buf, "GITHEAD_%s",
1356 - sha1_to_hex(get_object_hash(commit->object)));
1356 + sha1_to_hex(commit->object.oid.hash));
1357 setenv(buf.buf, merge_remote_util(commit)->name, 1);
1358 strbuf_reset(&buf);
1359 if (fast_forward != FF_ONLY &&
@@ -1393,7 +1393,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1393 free(list);
1394 }
1395
1396 - update_ref("updating ORIG_HEAD", "ORIG_HEAD", get_object_hash(head_commit->object),
1396 + update_ref("updating ORIG_HEAD", "ORIG_HEAD", head_commit->object.oid.hash,
1397 NULL, 0, UPDATE_REFS_DIE_ON_ERR);
1398
1399 if (remoteheads && !common)
@@ -1409,16 +1409,16 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1409 goto done;
1410 } else if (fast_forward != FF_NO && !remoteheads->next &&
1411 !common->next &&
1412 - !hashcmp(get_object_hash(common->item->object), get_object_hash(head_commit->object))) {
1412 + !hashcmp(common->item->object.oid.hash, head_commit->object.oid.hash)) {
1413 /* Again the most common case of merging one remote. */
1414 struct strbuf msg = STRBUF_INIT;
1415 struct commit *commit;
1416
1417 if (verbosity >= 0) {
1418 char from[GIT_SHA1_HEXSZ + 1], to[GIT_SHA1_HEXSZ + 1];
1419 - find_unique_abbrev_r(from, get_object_hash(head_commit->object),
1419 + find_unique_abbrev_r(from, head_commit->object.oid.hash,
1420 DEFAULT_ABBREV);
1421 - find_unique_abbrev_r(to, get_object_hash(remoteheads->item->object),
1421 + find_unique_abbrev_r(to, remoteheads->item->object.oid.hash,
1422 DEFAULT_ABBREV);
1423 printf(_("Updating %s..%s\n"), from, to);
1424 }
@@ -1432,14 +1432,14 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1432 goto done;
1433 }
1434
1435 - if (checkout_fast_forward(get_object_hash(head_commit->object),
1436 - get_object_hash(commit->object),
1435 + if (checkout_fast_forward(head_commit->object.oid.hash,
1436 + commit->object.oid.hash,
1437 overwrite_ignore)) {
1438 ret = 1;
1439 goto done;
1440 }
1441
1442 - finish(head_commit, remoteheads, get_object_hash(commit->object), msg.buf);
1442 + finish(head_commit, remoteheads, commit->object.oid.hash, msg.buf);
1443 drop_save();
1444 goto done;
1445 } else if (!remoteheads->next && common->next)
@@ -1458,9 +1458,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1458 /* See if it is really trivial. */
1459 git_committer_info(IDENT_STRICT);
1460 printf(_("Trying really trivial in-index merge...\n"));
1461 - if (!read_tree_trivial(get_object_hash(common->item->object),
1462 - get_object_hash(head_commit->object),
1463 - get_object_hash(remoteheads->item->object))) {
1461 + if (!read_tree_trivial(common->item->object.oid.hash,
1462 + head_commit->object.oid.hash,
1463 + remoteheads->item->object.oid.hash)) {
1464 ret = merge_trivial(head_commit, remoteheads);
1465 goto done;
1466 }
@@ -1483,8 +1483,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1483 * HEAD^^" would be missed.
1484 */
1485 common_one = get_merge_bases(head_commit, j->item);
1486 - if (hashcmp(get_object_hash(common_one->item->object),
1487 - get_object_hash(j->item->object))) {
1486 + if (hashcmp(common_one->item->object.oid.hash,
1487 + j->item->object.oid.hash)) {
1488 up_to_date = 0;
1489 break;
1490 }
@@ -1520,7 +1520,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1520 int ret;
1521 if (i) {
1522 printf(_("Rewinding the tree to pristine...\n"));
1523 - restore_state(get_object_hash(head_commit->object), stash);
1523 + restore_state(head_commit->object.oid.hash, stash);
1524 }
1525 if (use_strategies_nr != 1)
1526 printf(_("Trying merge strategy %s...\n"),
@@ -1586,7 +1586,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1586 * it up.
1587 */
1588 if (!best_strategy) {
1589 - restore_state(get_object_hash(head_commit->object), stash);
1589 + restore_state(head_commit->object.oid.hash, stash);
1590 if (use_strategies_nr > 1)
1591 fprintf(stderr,
1592 _("No merge strategy handled the merge.\n"));
@@ -1599,7 +1599,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
1599 ; /* We already have its result in the working tree. */
1600 else {
1601 printf(_("Rewinding the tree to pristine...\n"));
1602 - restore_state(get_object_hash(head_commit->object), stash);
1602 + restore_state(head_commit->object.oid.hash, stash);
1603 printf(_("Using the %s to prepare resolving by hand.\n"),
1604 best_strategy);
1605 try_merge_strategy(best_strategy, common, remoteheads,
builtin/name-rev.c
+2 -2
@@ -162,7 +162,7 @@ static int name_ref(const char *path, const struct object_id *oid, int flags, vo
162 struct tag *t = (struct tag *) o;
163 if (!t->tagged)
164 break; /* broken repository */
165 - o = parse_object(get_object_hash(*t->tagged));
165 + o = parse_object(t->tagged->oid.hash);
166 deref = 1;
167 }
168 if (o && o->type == OBJ_COMMIT) {
@@ -193,7 +193,7 @@ static const char *get_exact_ref_match(const struct object *o)
193 tip_table.sorted = 1;
194 }
195
196 - found = sha1_pos(get_object_hash(*o), tip_table.table, tip_table.nr,
196 + found = sha1_pos(o->oid.hash, tip_table.table, tip_table.nr,
197 nth_tip_table_ent);
198 if (0 <= found)
199 return tip_table.table[found].refname;
builtin/notes.c
+1 -1
@@ -707,7 +707,7 @@ static int merge_commit(struct notes_merge_options *o)
707 die("Could not parse commit from NOTES_MERGE_PARTIAL.");
708
709 if (partial->parents)
710 - hashcpy(parent_sha1, get_object_hash(partial->parents->item->object));
710 + hashcpy(parent_sha1, partial->parents->item->object.oid.hash);
711 else
712 hashclr(parent_sha1);
713
builtin/pack-objects.c
+7 -7
@@ -2277,7 +2277,7 @@ static void read_object_list_from_stdin(void)
2277
2278 static void show_commit(struct commit *commit, void *data)
2279 {
2280 - add_object_entry(get_object_hash(commit->object), OBJ_COMMIT, NULL, 0);
2280 + add_object_entry(commit->object.oid.hash, OBJ_COMMIT, NULL, 0);
2281 commit->object.flags |= OBJECT_ADDED;
2282
2283 if (write_bitmap_index)
@@ -2291,7 +2291,7 @@ static void show_object(struct object *obj,
2291 char *name = path_name(path, last);
2292
2293 add_preferred_base_object(name);
2294 - add_object_entry(get_object_hash(*obj), obj->type, name, 0);
2294 + add_object_entry(obj->oid.hash, obj->type, name, 0);
2295 obj->flags |= OBJECT_ADDED;
2296
2297 /*
@@ -2303,7 +2303,7 @@ static void show_object(struct object *obj,
2303
2304 static void show_edge(struct commit *commit)
2305 {
2306 - add_preferred_base(get_object_hash(commit->object));
2306 + add_preferred_base(commit->object.oid.hash);
2307 }
2308
2309 struct in_pack_object {
@@ -2319,7 +2319,7 @@ struct in_pack {
2319
2320 static void mark_in_pack_object(struct object *object, struct packed_git *p, struct in_pack *in_pack)
2321 {
2322 - in_pack->array[in_pack->nr].offset = find_pack_entry_one(get_object_hash(*object), p);
2322 + in_pack->array[in_pack->nr].offset = find_pack_entry_one(object->oid.hash, p);
2323 in_pack->array[in_pack->nr].object = object;
2324 in_pack->nr++;
2325 }
@@ -2376,7 +2376,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
2376 ofscmp);
2377 for (i = 0; i < in_pack.nr; i++) {
2378 struct object *o = in_pack.array[i].object;
2379 - add_object_entry(get_object_hash(*o), o->type, "", 0);
2379 + add_object_entry(o->oid.hash, o->type, "", 0);
2380 }
2381 }
2382 free(in_pack.array);
@@ -2484,12 +2484,12 @@ static void record_recent_object(struct object *obj,
2484 const char *last,
2485 void *data)
2486 {
2487 - sha1_array_append(&recent_objects, get_object_hash(*obj));
2487 + sha1_array_append(&recent_objects, obj->oid.hash);
2488 }
2489
2490 static void record_recent_commit(struct commit *commit, void *data)
2491 {
2492 - sha1_array_append(&recent_objects, get_object_hash(commit->object));
2492 + sha1_array_append(&recent_objects, commit->object.oid.hash);
2493 }
2494
2495 static void get_object_list(int ac, const char **av)
builtin/pull.c
+1 -1
@@ -743,7 +743,7 @@ static int get_octopus_merge_base(unsigned char *merge_base,
743 if (!result)
744 return 1;
745
746 - hashcpy(merge_base, get_object_hash(result->item->object));
746 + hashcpy(merge_base, result->item->object.oid.hash);
747 return 0;
748 }
749
builtin/reflog.c
+2 -2
@@ -126,7 +126,7 @@ static int commit_is_complete(struct commit *commit)
126 struct commit_list *parent;
127
128 c = (struct commit *)study.objects[--study.nr].item;
129 - if (!c->object.parsed && !parse_object(get_object_hash(c->object)))
129 + if (!c->object.parsed && !parse_object(c->object.oid.hash))
130 c->object.flags |= INCOMPLETE;
131
132 if (c->object.flags & INCOMPLETE) {
@@ -152,7 +152,7 @@ static int commit_is_complete(struct commit *commit)
152 for (i = 0; i < found.nr; i++) {
153 struct commit *c =
154 (struct commit *)found.objects[i].item;
155 - if (!tree_is_complete(get_object_hash(c->tree->object))) {
155 + if (!tree_is_complete(c->tree->object.oid.hash)) {
156 is_incomplete = 1;
157 c->object.flags |= INCOMPLETE;
158 }
builtin/reset.c
+1 -1
@@ -96,7 +96,7 @@ static void print_new_head_line(struct commit *commit)
96 const char *hex, *body;
97 const char *msg;
98
99 - hex = find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV);
99 + hex = find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV);
100 printf(_("HEAD is now at %s"), hex);
101 msg = logmsg_reencode(commit, NULL, get_log_output_encoding());
102 body = strstr(msg, "\n\n");
builtin/rev-list.c
+2 -2
@@ -81,7 +81,7 @@ static void show_commit(struct commit *commit, void *data)
81 if (!revs->graph)
82 fputs(get_revision_mark(revs, commit), stdout);
83 if (revs->abbrev_commit && revs->abbrev)
84 - fputs(find_unique_abbrev(get_object_hash(commit->object), revs->abbrev),
84 + fputs(find_unique_abbrev(commit->object.oid.hash, revs->abbrev),
85 stdout);
86 else
87 fputs(oid_to_hex(&commit->object.oid), stdout);
@@ -185,7 +185,7 @@ static void finish_object(struct object *obj,
185 if (obj->type == OBJ_BLOB && !has_object_file(&obj->oid))
186 die("missing blob object '%s'", oid_to_hex(&obj->oid));
187 if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
188 - parse_object(get_object_hash(*obj));
188 + parse_object(obj->oid.hash);
189 }
190
191 static void show_object(struct object *obj,
builtin/rev-parse.c
+2 -2
@@ -282,7 +282,7 @@ static int try_difference(const char *arg)
282 exclude = get_merge_bases(a, b);
283 while (exclude) {
284 struct commit *commit = pop_commit(&exclude);
285 - show_rev(REVERSED, get_object_hash(commit->object), NULL);
285 + show_rev(REVERSED, commit->object.oid.hash, NULL);
286 }
287 }
288 *dotdot = '.';
@@ -319,7 +319,7 @@ static int try_parent_shorthands(const char *arg)
319 commit = lookup_commit_reference(sha1);
320 for (parents = commit->parents; parents; parents = parents->next)
321 show_rev(parents_only ? NORMAL : REVERSED,
322 - get_object_hash(parents->item->object), arg);
322 + parents->item->object.oid.hash, arg);
323
324 *dotdot = '^';
325 return 1;
builtin/show-branch.c
+2 -2
@@ -291,7 +291,7 @@ static void show_one_commit(struct commit *commit, int no_name)
291 }
292 else
293 printf("[%s] ",
294 - find_unique_abbrev(get_object_hash(commit->object),
294 + find_unique_abbrev(commit->object.oid.hash,
295 DEFAULT_ABBREV));
296 }
297 puts(pretty_str);
@@ -867,7 +867,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
867 head_len,
868 ref_name[i],
869 head_oid.hash,
870 - get_object_hash(rev[i]->object));
870 + rev[i]->object.oid.hash);
871 if (extra < 0)
872 printf("%c [%s] ",
873 is_head ? '*' : ' ', ref_name[i]);
builtin/unpack-objects.c
+1 -1
@@ -194,7 +194,7 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
194
195 if (!(obj->flags & FLAG_OPEN)) {
196 unsigned long size;
197 - int type = sha1_object_info(get_object_hash(*obj), &size);
197 + int type = sha1_object_info(obj->oid.hash, &size);
198 if (type != obj->type || type <= 0)
199 die("object of unexpected type");
200 obj->flags |= FLAG_WRITTEN;
bundle.c
+1 -1
@@ -217,7 +217,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)
217 if (revs->max_age == -1 && revs->min_age == -1)
218 goto out;
219
220 - buf = read_sha1_file(get_object_hash(*tag), &type, &size);
220 + buf = read_sha1_file(tag->oid.hash, &type, &size);
221 if (!buf)
222 goto out;
223 line = memmem(buf, size, "\ntagger ", 8);
cache-tree.c
+1 -1
@@ -657,7 +657,7 @@ static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
657 struct name_entry entry;
658 int cnt;
659
660 - hashcpy(it->sha1, get_object_hash(tree->object));
660 + hashcpy(it->sha1, tree->object.oid.hash);
661 init_tree_desc(&desc, tree->buffer, tree->size);
662 cnt = 0;
663 while (tree_entry(&desc, &entry)) {
combine-diff.c
+2 -2
@@ -1540,9 +1540,9 @@ void diff_tree_combined_merge(const struct commit *commit, int dense,
1540 struct sha1_array parents = SHA1_ARRAY_INIT;
1541
1542 while (parent) {
1543 - sha1_array_append(&parents, get_object_hash(parent->item->object));
1543 + sha1_array_append(&parents, parent->item->object.oid.hash);
1544 parent = parent->next;
1545 }
1546 - diff_tree_combined(get_object_hash(commit->object), &parents, dense, rev);
1546 + diff_tree_combined(commit->object.oid.hash, &parents, dense, rev);
1547 sha1_array_clear(&parents);
1548 }
commit.c
+6 -6
@@ -38,7 +38,7 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n
38 struct commit *c = lookup_commit_reference(sha1);
39 if (!c)
40 die(_("could not parse %s"), ref_name);
41 - if (hashcmp(sha1, get_object_hash(c->object))) {
41 + if (hashcmp(sha1, c->object.oid.hash)) {
42 warning(_("%s %s is not a commit!"),
43 ref_name, sha1_to_hex(sha1));
44 }
@@ -262,7 +262,7 @@ const void *get_commit_buffer(const struct commit *commit, unsigned long *sizep)
262 if (!ret) {
263 enum object_type type;
264 unsigned long size;
265 - ret = read_sha1_file(get_object_hash(commit->object), &type, &size);
265 + ret = read_sha1_file(commit->object.oid.hash, &type, &size);
266 if (!ret)
267 die("cannot read commit object %s",
268 oid_to_hex(&commit->object.oid));
@@ -335,7 +335,7 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
335 bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
336 pptr = &item->parents;
337
338 - graft = lookup_commit_graft(get_object_hash(item->object));
338 + graft = lookup_commit_graft(item->object.oid.hash);
339 while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
340 struct commit *new_parent;
341
@@ -380,7 +380,7 @@ int parse_commit_gently(struct commit *item, int quiet_on_missing)
380 return -1;
381 if (item->object.parsed)
382 return 0;
383 - buffer = read_sha1_file(get_object_hash(item->object), &type, &size);
383 + buffer = read_sha1_file(item->object.oid.hash, &type, &size);
384 if (!buffer)
385 return quiet_on_missing ? -1 :
386 error("Could not read %s",
@@ -563,7 +563,7 @@ void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
563
564 for (i = 0; i < a->nr; i++) {
565 object = a->objects[i].item;
566 - commit = lookup_commit_reference_gently(get_object_hash(*object), 1);
566 + commit = lookup_commit_reference_gently(object->oid.hash, 1);
567 if (commit)
568 clear_commit_marks(commit, mark);
569 }
@@ -1206,7 +1206,7 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
1206 desc = merge_remote_util(parent);
1207 if (!desc || !desc->obj)
1208 return;
1209 - buf = read_sha1_file(get_object_hash(*desc->obj), &type, &size);
1209 + buf = read_sha1_file(desc->obj->oid.hash, &type, &size);
1210 if (!buf || type != OBJ_TAG)
1211 goto free_return;
1212 len = parse_signature(buf, size);
decorate.c
+1 -1
@@ -8,7 +8,7 @@
8
9 static unsigned int hash_obj(const struct object *obj, unsigned int n)
10 {
11 - return sha1hash(get_object_hash(*obj)) % n;
11 + return sha1hash(obj->oid.hash) % n;
12 }
13
14 static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)
diff-lib.c
+1 -1
@@ -493,7 +493,7 @@ int run_diff_index(struct rev_info *revs, int cached)
493 struct object_array_entry *ent;
494
495 ent = revs->pending.objects;
496 - if (diff_cache(revs, get_object_hash(*ent->item), ent->name, cached))
496 + if (diff_cache(revs, ent->item->oid.hash, ent->name, cached))
497 exit(128);
498
499 diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
fetch-pack.c
+2 -2
@@ -169,7 +169,7 @@ static const unsigned char *get_rev(void)
169 }
170 }
171
172 - return get_object_hash(commit->object);
172 + return commit->object.oid.hash;
173 }
174
175 enum ack_type {
@@ -487,7 +487,7 @@ static int mark_complete(const unsigned char *sha1)
487 if (!t->tagged)
488 break; /* broken repository */
489 o->flags |= COMPLETE;
490 - o = parse_object(get_object_hash(*t->tagged));
490 + o = parse_object(t->tagged->oid.hash);
491 }
492 if (o && o->type == OBJ_COMMIT) {
493 struct commit *commit = (struct commit *)o;
fsck.c
+3 -3
@@ -276,7 +276,7 @@ static int report(struct fsck_options *options, struct object *object,
276 return 0;
277
278 if (options->skiplist && object &&
279 - sha1_array_lookup(options->skiplist, get_object_hash(*object)) >= 0)
279 + sha1_array_lookup(options->skiplist, object->oid.hash) >= 0)
280 return 0;
281
282 if (msg_type == FSCK_FATAL)
@@ -630,7 +630,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
630 buffer += 41;
631 parent_line_count++;
632 }
633 - graft = lookup_commit_graft(get_object_hash(commit->object));
633 + graft = lookup_commit_graft(commit->object.oid.hash);
634 parent_count = commit_list_count(commit->parents);
635 if (graft) {
636 if (graft->nr_parent == -1 && !parent_count)
@@ -696,7 +696,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
696 enum object_type type;
697
698 buffer = to_free =
699 - read_sha1_file(get_object_hash(tag->object), &type, &size);
699 + read_sha1_file(tag->object.oid.hash, &type, &size);
700 if (!buffer)
701 return report(options, &tag->object,
702 FSCK_MSG_MISSING_TAG_OBJECT,
http-push.c
+10 -10
@@ -251,7 +251,7 @@ static void start_fetch_loose(struct transfer_request *request)
251 struct active_request_slot *slot;
252 struct http_object_request *obj_req;
253
254 - obj_req = new_http_object_request(repo->url, get_object_hash(*request->obj));
254 + obj_req = new_http_object_request(repo->url, request->obj->oid.hash);
255 if (obj_req == NULL) {
256 request->state = ABORTED;
257 return;
@@ -304,7 +304,7 @@ static void start_fetch_packed(struct transfer_request *request)
304 struct transfer_request *check_request = request_queue_head;
305 struct http_pack_request *preq;
306
307 - target = find_sha1_pack(get_object_hash(*request->obj), repo->packs);
307 + target = find_sha1_pack(request->obj->oid.hash, repo->packs);
308 if (!target) {
309 fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid));
310 repo->can_update_info_refs = 0;
@@ -361,7 +361,7 @@ static void start_put(struct transfer_request *request)
361 ssize_t size;
362 git_zstream stream;
363
364 - unpacked = read_sha1_file(get_object_hash(*request->obj), &type, &len);
364 + unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
365 hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
366
367 /* Set it up */
@@ -533,7 +533,7 @@ static void finish_request(struct transfer_request *request)
533 if (request->state == RUN_MKCOL) {
534 if (request->curl_result == CURLE_OK ||
535 request->http_code == 405) {
536 - remote_dir_exists[get_object_hash(*request->obj)[0]] = 1;
536 + remote_dir_exists[request->obj->oid.hash[0]] = 1;
537 start_put(request);
538 } else {
539 fprintf(stderr, "MKCOL %s failed, aborting (%d/%ld)\n",
@@ -614,7 +614,7 @@ static int fill_active_slot(void *unused)
614 start_fetch_loose(request);
615 return 1;
616 } else if (pushing && request->state == NEED_PUSH) {
617 - if (remote_dir_exists[get_object_hash(*request->obj)[0]] == 1) {
617 + if (remote_dir_exists[request->obj->oid.hash[0]] == 1) {
618 start_put(request);
619 } else {
620 start_mkcol(request);
@@ -638,8 +638,8 @@ static void add_fetch_request(struct object *obj)
638 * Don't fetch the object if it's known to exist locally
639 * or is already in the request queue
640 */
641 - if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
642 - get_remote_object_list(get_object_hash(*obj)[0]);
641 + if (remote_dir_exists[obj->oid.hash[0]] == -1)
642 + get_remote_object_list(obj->oid.hash[0]);
643 if (obj->flags & (LOCAL | FETCHING))
644 return;
645
@@ -671,11 +671,11 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
671 * Don't push the object if it's known to exist on the remote
672 * or is already in the request queue
673 */
674 - if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
675 - get_remote_object_list(get_object_hash(*obj)[0]);
674 + if (remote_dir_exists[obj->oid.hash[0]] == -1)
675 + get_remote_object_list(obj->oid.hash[0]);
676 if (obj->flags & (REMOTE | PUSHING))
677 return 0;
678 - target = find_sha1_pack(get_object_hash(*obj), repo->packs);
678 + target = find_sha1_pack(obj->oid.hash, repo->packs);
679 if (target) {
680 obj->flags |= REMOTE;
681 return 0;
line-log.c
+3 -3
@@ -502,7 +502,7 @@ static void fill_blob_sha1(struct commit *commit, struct diff_filespec *spec)
502 unsigned mode;
503 unsigned char sha1[20];
504
505 - if (get_tree_entry(get_object_hash(commit->object), spec->path,
505 + if (get_tree_entry(commit->object.oid.hash, spec->path,
506 sha1, &mode))
507 die("There is no path %s in the commit", spec->path);
508 fill_filespec(spec, sha1, 1, mode);
@@ -824,8 +824,8 @@ static void queue_diffs(struct line_log_data *range,
824 assert(commit);
825
826 DIFF_QUEUE_CLEAR(&diff_queued_diff);
827 - diff_tree_sha1(parent ? get_object_hash(parent->tree->object) : NULL,
828 - get_object_hash(commit->tree->object), "", opt);
827 + diff_tree_sha1(parent ? parent->tree->object.oid.hash : NULL,
828 + commit->tree->object.oid.hash, "", opt);
829 if (opt->detect_rename) {
830 filter_diffs_for_paths(range, 1);
831 if (diff_might_be_rename())
log-tree.c
+10 -10
@@ -133,7 +133,7 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
133 if (!obj)
134 break;
135 if (!obj->parsed)
136 - parse_object(get_object_hash(*obj));
136 + parse_object(obj->oid.hash);
137 add_name_decoration(DECORATION_REF_TAG, refname, obj);
138 }
139 return 0;
@@ -165,7 +165,7 @@ static void show_parents(struct commit *commit, int abbrev)
165 struct commit_list *p;
166 for (p = commit->parents; p ; p = p->next) {
167 struct commit *parent = p->item;
168 - printf(" %s", find_unique_abbrev(get_object_hash(parent->object), abbrev));
168 + printf(" %s", find_unique_abbrev(parent->object.oid.hash, abbrev));
169 }
170 }
171
@@ -173,7 +173,7 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
173 {
174 struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
175 for ( ; p; p = p->next) {
176 - printf(" %s", find_unique_abbrev(get_object_hash(p->item->object), abbrev));
176 + printf(" %s", find_unique_abbrev(p->item->object.oid.hash, abbrev));
177 }
178 }
179
@@ -469,7 +469,7 @@ static int which_parent(const unsigned char *sha1, const struct commit *commit)
469 const struct commit_list *parent;
470
471 for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
472 - if (!hashcmp(get_object_hash(parent->item->object), sha1))
472 + if (!hashcmp(parent->item->object.oid.hash, sha1))
473 return nth;
474 nth++;
475 }
@@ -507,9 +507,9 @@ static void show_one_mergetag(struct commit *commit,
507 &commit->parents->next->item->object.oid))
508 strbuf_addf(&verify_message,
509 "merged tag '%s'\n", tag->tag);
510 - else if ((nth = which_parent(get_object_hash(*tag->tagged), commit)) < 0)
510 + else if ((nth = which_parent(tag->tagged->oid.hash, commit)) < 0)
511 strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
512 - tag->tag, get_object_hash(*tag->tagged));
512 + tag->tag, tag->tagged->oid.hash);
513 else
514 strbuf_addf(&verify_message,
515 "parent #%d, tagged '%s'\n", nth + 1, tag->tag);
@@ -553,7 +553,7 @@ void show_log(struct rev_info *opt)
553
554 if (!opt->graph)
555 put_revision_mark(opt, commit);
556 - fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit), stdout);
556 + fputs(find_unique_abbrev(commit->object.oid.hash, abbrev_commit), stdout);
557 if (opt->print_parents)
558 show_parents(commit, abbrev_commit);
559 if (opt->children.name)
@@ -613,7 +613,7 @@ void show_log(struct rev_info *opt)
613
614 if (!opt->graph)
615 put_revision_mark(opt, commit);
616 - fputs(find_unique_abbrev(get_object_hash(commit->object), abbrev_commit),
616 + fputs(find_unique_abbrev(commit->object.oid.hash, abbrev_commit),
617 stdout);
618 if (opt->print_parents)
619 show_parents(commit, abbrev_commit);
@@ -621,7 +621,7 @@ void show_log(struct rev_info *opt)
621 show_children(opt, commit, abbrev_commit);
622 if (parent)
623 printf(" (from %s)",
624 - find_unique_abbrev(get_object_hash(parent->object),
624 + find_unique_abbrev(parent->object.oid.hash,
625 abbrev_commit));
626 fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), stdout);
627 show_decorations(opt, commit);
@@ -660,7 +660,7 @@ void show_log(struct rev_info *opt)
660 struct strbuf notebuf = STRBUF_INIT;
661
662 raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
663 - format_display_notes(get_object_hash(commit->object), &notebuf,
663 + format_display_notes(commit->object.oid.hash, &notebuf,
664 get_log_output_encoding(), raw);
665 ctx.notes_message = notebuf.len
666 ? strbuf_detach(&notebuf, NULL)
merge-blobs.c
+2 -2
@@ -11,7 +11,7 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
11 unsigned long size;
12 enum object_type type;
13
14 - buf = read_sha1_file(get_object_hash(obj->object), &type, &size);
14 + buf = read_sha1_file(obj->object.oid.hash, &type, &size);
15 if (!buf)
16 return -1;
17 if (type != OBJ_BLOB) {
@@ -100,7 +100,7 @@ void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct
100 return NULL;
101 if (!our)
102 our = their;
103 - return read_sha1_file(get_object_hash(our->object), &type, size);
103 + return read_sha1_file(our->object.oid.hash, &type, size);
104 }
105
106 if (fill_mmfile_blob(&f1, our) < 0)
merge-recursive.c
+8 -8
@@ -29,9 +29,9 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
29 struct object_id shifted;
30
31 if (!*subtree_shift) {
32 - shift_tree(get_object_hash(one->object), get_object_hash(two->object), shifted.hash, 0);
32 + shift_tree(one->object.oid.hash, two->object.oid.hash, shifted.hash, 0);
33 } else {
34 - shift_tree_by(get_object_hash(one->object), get_object_hash(two->object), shifted.hash,
34 + shift_tree_by(one->object.oid.hash, two->object.oid.hash, shifted.hash,
35 subtree_shift);
36 }
37 if (!oidcmp(&two->object.oid, &shifted))
@@ -184,7 +184,7 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
184 if (commit->util)
185 printf("virtual %s\n", merge_remote_util(commit)->name);
186 else {
187 - printf("%s ", find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV));
187 + printf("%s ", find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
188 if (parse_commit(commit) != 0)
189 printf(_("(bad commit)\n"));
190 else {
@@ -313,11 +313,11 @@ static struct stage_data *insert_stage_data(const char *path,
313 {
314 struct string_list_item *item;
315 struct stage_data *e = xcalloc(1, sizeof(struct stage_data));
316 - get_tree_entry(get_object_hash(o->object), path,
316 + get_tree_entry(o->object.oid.hash, path,
317 e->stages[1].sha, &e->stages[1].mode);
318 - get_tree_entry(get_object_hash(a->object), path,
318 + get_tree_entry(a->object.oid.hash, path,
319 e->stages[2].sha, &e->stages[2].mode);
320 - get_tree_entry(get_object_hash(b->object), path,
320 + get_tree_entry(b->object.oid.hash, path,
321 e->stages[3].sha, &e->stages[3].mode);
322 item = string_list_insert(entries, path);
323 item->util = e;
@@ -493,7 +493,7 @@ static struct string_list *get_renames(struct merge_options *o,
493 opts.show_rename_progress = o->show_rename_progress;
494 opts.output_format = DIFF_FORMAT_NO_OUTPUT;
495 diff_setup_done(&opts);
496 - diff_tree_sha1(get_object_hash(o_tree->object), get_object_hash(tree->object), "", &opts);
496 + diff_tree_sha1(o_tree->object.oid.hash, tree->object.oid.hash, "", &opts);
497 diffcore_std(&opts);
498 if (opts.needed_rename_limit > o->needed_rename_limit)
499 o->needed_rename_limit = opts.needed_rename_limit;
@@ -1812,7 +1812,7 @@ int merge_trees(struct merge_options *o,
1812 common = shift_tree_object(head, common, o->subtree_shift);
1813 }
1814
1815 - if (sha_eq(get_object_hash(common->object), get_object_hash(merge->object))) {
1815 + if (sha_eq(common->object.oid.hash, merge->object.oid.hash)) {
1816 output(o, 0, _("Already up-to-date!"));
1817 *result = head;
1818 return 1;
notes-merge.c
+10 -10
@@ -602,15 +602,15 @@ int notes_merge(struct notes_merge_options *o,
602 if (o->verbosity >= 4)
603 printf("No merge base found; doing history-less merge\n");
604 } else if (!bases->next) {
605 - base_sha1 = get_object_hash(bases->item->object);
606 - base_tree_sha1 = get_object_hash(bases->item->tree->object);
605 + base_sha1 = bases->item->object.oid.hash;
606 + base_tree_sha1 = bases->item->tree->object.oid.hash;
607 if (o->verbosity >= 4)
608 printf("One merge base found (%.7s)\n",
609 sha1_to_hex(base_sha1));
610 } else {
611 /* TODO: How to handle multiple merge-bases? */
612 - base_sha1 = get_object_hash(bases->item->object);
613 - base_tree_sha1 = get_object_hash(bases->item->tree->object);
612 + base_sha1 = bases->item->object.oid.hash;
613 + base_tree_sha1 = bases->item->tree->object.oid.hash;
614 if (o->verbosity >= 3)
615 printf("Multiple merge bases found. Using the first "
616 "(%.7s)\n", sha1_to_hex(base_sha1));
@@ -622,23 +622,23 @@ int notes_merge(struct notes_merge_options *o,
622 oid_to_hex(&local->object.oid),
623 sha1_to_hex(base_sha1));
624
625 - if (!hashcmp(get_object_hash(remote->object), base_sha1)) {
625 + if (!hashcmp(remote->object.oid.hash, base_sha1)) {
626 /* Already merged; result == local commit */
627 if (o->verbosity >= 2)
628 printf("Already up-to-date!\n");
629 - hashcpy(result_sha1, get_object_hash(local->object));
629 + hashcpy(result_sha1, local->object.oid.hash);
630 goto found_result;
631 }
632 - if (!hashcmp(get_object_hash(local->object), base_sha1)) {
632 + if (!hashcmp(local->object.oid.hash, base_sha1)) {
633 /* Fast-forward; result == remote commit */
634 if (o->verbosity >= 2)
635 printf("Fast-forward\n");
636 - hashcpy(result_sha1, get_object_hash(remote->object));
636 + hashcpy(result_sha1, remote->object.oid.hash);
637 goto found_result;
638 }
639
640 - result = merge_from_diffs(o, base_tree_sha1, get_object_hash(local->tree->object),
641 - get_object_hash(remote->tree->object), local_tree);
640 + result = merge_from_diffs(o, base_tree_sha1, local->tree->object.oid.hash,
641 + remote->tree->object.oid.hash, local_tree);
642
643 if (result != 0) { /* non-trivial merge (with or without conflicts) */
644 /* Commit (partial) result */
object.c
+3 -3
@@ -68,7 +68,7 @@ static unsigned int hash_obj(const unsigned char *sha1, unsigned int n)
68 */
69 static void insert_obj_hash(struct object *obj, struct object **hash, unsigned int size)
70 {
71 - unsigned int j = hash_obj(get_object_hash(*obj), size);
71 + unsigned int j = hash_obj(obj->oid.hash, size);
72
73 while (hash[j]) {
74 j++;
@@ -92,7 +92,7 @@ struct object *lookup_object(const unsigned char *sha1)
92
93 first = i = hash_obj(sha1, obj_hash_size);
94 while ((obj = obj_hash[i]) != NULL) {
95 - if (!hashcmp(sha1, get_object_hash(*obj)))
95 + if (!hashcmp(sha1, obj->oid.hash))
96 break;
97 i++;
98 if (i == obj_hash_size)
@@ -145,7 +145,7 @@ void *create_object(const unsigned char *sha1, void *o)
145 obj->parsed = 0;
146 obj->used = 0;
147 obj->flags = 0;
148 - hashcpy(get_object_hash(*obj), sha1);
148 + hashcpy(obj->oid.hash, sha1);
149
150 if (obj_hash_size - 1 <= nr_objs * 2)
151 grow_object_hash();
object.h
-2
@@ -52,8 +52,6 @@ struct object {
52 struct object_id oid;
53 };
54
55 -#define get_object_hash(x) ((x).oid.hash)
56 -
55 extern const char *typename(unsigned int type);
56 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
57 #define type_from_string(str) type_from_string_gently(str, -1, 0)
pack-bitmap-write.c
+7 -7
@@ -152,7 +152,7 @@ static void show_object(struct object *object, const struct name_path *path,
152 const char *last, void *data)
153 {
154 struct bitmap *base = data;
155 - bitmap_set(base, find_object_pos(get_object_hash(*object)));
155 + bitmap_set(base, find_object_pos(object->oid.hash));
156 mark_as_seen(object);
157 }
158
@@ -165,12 +165,12 @@ static int
165 add_to_include_set(struct bitmap *base, struct commit *commit)
166 {
167 khiter_t hash_pos;
168 - uint32_t bitmap_pos = find_object_pos(get_object_hash(commit->object));
168 + uint32_t bitmap_pos = find_object_pos(commit->object.oid.hash);
169
170 if (bitmap_get(base, bitmap_pos))
171 return 0;
172
173 - hash_pos = kh_get_sha1(writer.bitmaps, get_object_hash(commit->object));
173 + hash_pos = kh_get_sha1(writer.bitmaps, commit->object.oid.hash);
174 if (hash_pos < kh_end(writer.bitmaps)) {
175 struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
176 bitmap_or_ewah(base, bc->bitmap);
@@ -308,7 +308,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
308 if (i >= reuse_after)
309 stored->flags |= BITMAP_FLAG_REUSE;
310
311 - hash_pos = kh_put_sha1(writer.bitmaps, get_object_hash(*object), &hash_ret);
311 + hash_pos = kh_put_sha1(writer.bitmaps, object->oid.hash, &hash_ret);
312 if (hash_ret == 0)
313 die("Duplicate entry when writing index: %s",
314 oid_to_hex(&object->oid));
@@ -414,14 +414,14 @@ void bitmap_writer_select_commits(struct commit **indexed_commits,
414
415 if (next == 0) {
416 chosen = indexed_commits[i];
417 - reused_bitmap = find_reused_bitmap(get_object_hash(chosen->object));
417 + reused_bitmap = find_reused_bitmap(chosen->object.oid.hash);
418 } else {
419 chosen = indexed_commits[i + next];
420
421 for (j = 0; j <= next; ++j) {
422 struct commit *cm = indexed_commits[i + j];
423
424 - reused_bitmap = find_reused_bitmap(get_object_hash(cm->object));
424 + reused_bitmap = find_reused_bitmap(cm->object.oid.hash);
425 if (reused_bitmap || (cm->object.flags & NEEDS_BITMAP) != 0) {
426 chosen = cm;
427 break;
@@ -474,7 +474,7 @@ static void write_selected_commits_v1(struct sha1file *f,
474 struct bitmapped_commit *stored = &writer.selected[i];
475
476 int commit_pos =
477 - sha1_pos(get_object_hash(stored->commit->object), index, index_nr, sha1_access);
477 + sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
478
479 if (commit_pos < 0)
480 die("BUG: trying to write commit not in index");
pack-bitmap.c
+13 -13
@@ -397,7 +397,7 @@ static int ext_index_add_object(struct object *object, const char *name)
397 int hash_ret;
398 int bitmap_pos;
399
400 - hash_pos = kh_put_sha1_pos(eindex->positions, get_object_hash(*object), &hash_ret);
400 + hash_pos = kh_put_sha1_pos(eindex->positions, object->oid.hash, &hash_ret);
401 if (hash_ret > 0) {
402 if (eindex->count >= eindex->alloc) {
403 eindex->alloc = (eindex->alloc + 16) * 3 / 2;
@@ -423,7 +423,7 @@ static void show_object(struct object *object, const struct name_path *path,
423 struct bitmap *base = data;
424 int bitmap_pos;
425
426 - bitmap_pos = bitmap_position(get_object_hash(*object));
426 + bitmap_pos = bitmap_position(object->oid.hash);
427
428 if (bitmap_pos < 0) {
429 char *name = path_name(path, last);
@@ -466,11 +466,11 @@ static int should_include(struct commit *commit, void *_data)
466 struct include_data *data = _data;
467 int bitmap_pos;
468
469 - bitmap_pos = bitmap_position(get_object_hash(commit->object));
469 + bitmap_pos = bitmap_position(commit->object.oid.hash);
470 if (bitmap_pos < 0)
471 bitmap_pos = ext_index_add_object((struct object *)commit, NULL);
472
473 - if (!add_to_include_set(data, get_object_hash(commit->object), bitmap_pos)) {
473 + if (!add_to_include_set(data, commit->object.oid.hash, bitmap_pos)) {
474 struct commit_list *parent = commit->parents;
475
476 while (parent) {
@@ -506,7 +506,7 @@ static struct bitmap *find_objects(struct rev_info *revs,
506 roots = roots->next;
507
508 if (object->type == OBJ_COMMIT) {
509 - khiter_t pos = kh_get_sha1(bitmap_git.bitmaps, get_object_hash(*object));
509 + khiter_t pos = kh_get_sha1(bitmap_git.bitmaps, object->oid.hash);
510
511 if (pos < kh_end(bitmap_git.bitmaps)) {
512 struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
@@ -548,7 +548,7 @@ static struct bitmap *find_objects(struct rev_info *revs,
548 int pos;
549
550 roots = roots->next;
551 - pos = bitmap_position(get_object_hash(*object));
551 + pos = bitmap_position(object->oid.hash);
552
553 if (pos < 0 || base == NULL || !bitmap_get(base, pos)) {
554 object->flags &= ~UNINTERESTING;
@@ -593,7 +593,7 @@ static void show_extended_objects(struct bitmap *objects,
593 continue;
594
595 obj = eindex->objects[i];
596 - show_reach(get_object_hash(*obj), obj->type, 0, eindex->hashes[i], NULL, 0);
596 + show_reach(obj->oid.hash, obj->type, 0, eindex->hashes[i], NULL, 0);
597 }
598 }
599
@@ -650,7 +650,7 @@ static int in_bitmapped_pack(struct object_list *roots)
650 struct object *object = roots->item;
651 roots = roots->next;
652
653 - if (find_pack_entry_one(get_object_hash(*object), bitmap_git.pack) > 0)
653 + if (find_pack_entry_one(object->oid.hash, bitmap_git.pack) > 0)
654 return 1;
655 }
656
@@ -680,7 +680,7 @@ int prepare_bitmap_walk(struct rev_info *revs)
680 struct object *object = pending_e[i].item;
681
682 if (object->type == OBJ_NONE)
683 - parse_object_or_die(get_object_hash(*object), NULL);
683 + parse_object_or_die(object->oid.hash, NULL);
684
685 while (object->type == OBJ_TAG) {
686 struct tag *tag = (struct tag *) object;
@@ -692,7 +692,7 @@ int prepare_bitmap_walk(struct rev_info *revs)
692
693 if (!tag->tagged)
694 die("bad tag");
695 - object = parse_object_or_die(get_object_hash(*tag->tagged), NULL);
695 + object = parse_object_or_die(tag->tagged->oid.hash, NULL);
696 }
697
698 if (object->flags & UNINTERESTING)
@@ -904,7 +904,7 @@ static void test_show_object(struct object *object,
904 struct bitmap_test_data *tdata = data;
905 int bitmap_pos;
906
907 - bitmap_pos = bitmap_position(get_object_hash(*object));
907 + bitmap_pos = bitmap_position(object->oid.hash);
908 if (bitmap_pos < 0)
909 die("Object not in bitmap: %s\n", oid_to_hex(&object->oid));
910
@@ -917,7 +917,7 @@ static void test_show_commit(struct commit *commit, void *data)
917 struct bitmap_test_data *tdata = data;
918 int bitmap_pos;
919
920 - bitmap_pos = bitmap_position(get_object_hash(commit->object));
920 + bitmap_pos = bitmap_position(commit->object.oid.hash);
921 if (bitmap_pos < 0)
922 die("Object not in bitmap: %s\n", oid_to_hex(&commit->object.oid));
923
@@ -943,7 +943,7 @@ void test_bitmap_walk(struct rev_info *revs)
943 bitmap_git.version, bitmap_git.entry_count);
944
945 root = revs->pending.objects[0].item;
946 - pos = kh_get_sha1(bitmap_git.bitmaps, get_object_hash(*root));
946 + pos = kh_get_sha1(bitmap_git.bitmaps, root->oid.hash);
947
948 if (pos < kh_end(bitmap_git.bitmaps)) {
949 struct stored_bitmap *st = kh_value(bitmap_git.bitmaps, pos);
patch-ids.c
+3 -3
@@ -8,10 +8,10 @@ static int commit_patch_id(struct commit *commit, struct diff_options *options,
8 unsigned char *sha1)
9 {
10 if (commit->parents)
11 - diff_tree_sha1(get_object_hash(commit->parents->item->object),
12 - get_object_hash(commit->object), "", options);
11 + diff_tree_sha1(commit->parents->item->object.oid.hash,
12 + commit->object.oid.hash, "", options);
13 else
14 - diff_root_tree_sha1(get_object_hash(commit->object), "", options);
14 + diff_root_tree_sha1(commit->object.oid.hash, "", options);
15 diffcore_std(options);
16 return diff_flush_patch_id(options, sha1);
17 }
pretty.c
+4 -4
@@ -543,7 +543,7 @@ static void add_merge_info(const struct pretty_print_context *pp,
543 struct commit *p = parent->item;
544 const char *hex = NULL;
545 if (pp->abbrev)
546 - hex = find_unique_abbrev(get_object_hash(p->object), pp->abbrev);
546 + hex = find_unique_abbrev(p->object.oid.hash, pp->abbrev);
547 if (!hex)
548 hex = oid_to_hex(&p->object.oid);
549 parent = parent->next;
@@ -1119,7 +1119,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1119
1120 /* these depend on the commit */
1121 if (!commit->object.parsed)
1122 - parse_object(get_object_hash(commit->object));
1122 + parse_object(commit->object.oid.hash);
1123
1124 switch (placeholder[0]) {
1125 case 'H': /* commit hash */
@@ -1133,7 +1133,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1133 strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
1134 return 1;
1135 }
1136 - strbuf_addstr(sb, find_unique_abbrev(get_object_hash(commit->object),
1136 + strbuf_addstr(sb, find_unique_abbrev(commit->object.oid.hash,
1137 c->pretty_ctx->abbrev));
1138 strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET));
1139 c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off;
@@ -1162,7 +1162,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1162 if (p != commit->parents)
1163 strbuf_addch(sb, ' ');
1164 strbuf_addstr(sb, find_unique_abbrev(
1165 - get_object_hash(p->item->object),
1165 + p->item->object.oid.hash,
1166 c->pretty_ctx->abbrev));
1167 }
1168 c->abbrev_parent_hashes.len = sb->len -
ref-filter.c
+3 -3
@@ -372,7 +372,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
372 v->s = xstrfmt("%lu", sz);
373 }
374 else if (deref)
375 - grab_objectname(name, get_object_hash(*obj), v);
375 + grab_objectname(name, obj->oid.hash, v);
376 }
377 }
378
@@ -992,7 +992,7 @@ static void populate_value(struct ref_array_item *ref)
992 * If it is a tag object, see if we use a value that derefs
993 * the object, and if we do grab the object it refers to.
994 */
995 - tagged = get_object_hash(*((struct tag *)obj)->tagged);
995 + tagged = ((struct tag *)obj)->tagged->oid.hash;
996
997 /*
998 * NEEDSWORK: This derefs tag only once, which
@@ -1218,7 +1218,7 @@ static const unsigned char *match_points_at(struct sha1_array *points_at,
1218 if (!obj)
1219 die(_("malformed object at '%s'"), refname);
1220 if (obj->type == OBJ_TAG)
1221 - tagged_sha1 = get_object_hash(*((struct tag *)obj)->tagged);
1221 + tagged_sha1 = ((struct tag *)obj)->tagged->oid.hash;
1222 if (tagged_sha1 && sha1_array_lookup(points_at, tagged_sha1) >= 0)
1223 return tagged_sha1;
1224 return NULL;
refs.c
+1 -1
@@ -1880,7 +1880,7 @@ static enum peel_status peel_object(const unsigned char *name, unsigned char *sh
1880 if (!o)
1881 return PEEL_INVALID;
1882
1883 - hashcpy(sha1, get_object_hash(*o));
1883 + hashcpy(sha1, o->oid.hash);
1884 return PEEL_PEELED;
1885 }
1886
revision.c
+8 -8
@@ -282,7 +282,7 @@ static struct commit *handle_commit(struct rev_info *revs,
282 add_pending_object(revs, object, tag->tag);
283 if (!tag->tagged)
284 die("bad tag");
285 - object = parse_object(get_object_hash(*tag->tagged));
285 + object = parse_object(tag->tagged->oid.hash);
286 if (!object) {
287 if (flags & UNINTERESTING)
288 return NULL;
@@ -510,7 +510,7 @@ static int rev_compare_tree(struct rev_info *revs,
510
511 tree_difference = REV_TREE_SAME;
512 DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
513 - if (diff_tree_sha1(get_object_hash(t1->object), get_object_hash(t2->object), "",
513 + if (diff_tree_sha1(t1->object.oid.hash, t2->object.oid.hash, "",
514 &revs->pruning) < 0)
515 return REV_TREE_DIFFERENT;
516 return tree_difference;
@@ -526,7 +526,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
526
527 tree_difference = REV_TREE_SAME;
528 DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES);
529 - retval = diff_tree_sha1(NULL, get_object_hash(t1->object), "", &revs->pruning);
529 + retval = diff_tree_sha1(NULL, t1->object.oid.hash, "", &revs->pruning);
530
531 return retval >= 0 && (tree_difference == REV_TREE_SAME);
532 }
@@ -1378,7 +1378,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags)
1378 break;
1379 if (!((struct tag*)it)->tagged)
1380 return 0;
1381 - hashcpy(sha1, get_object_hash(*((struct tag*)it)->tagged));
1381 + hashcpy(sha1, ((struct tag*)it)->tagged->oid.hash);
1382 }
1383 if (it->type != OBJ_COMMIT)
1384 return 0;
@@ -1555,10 +1555,10 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
1555
1556 a = (a_obj->type == OBJ_COMMIT
1557 ? (struct commit *)a_obj
1558 - : lookup_commit_reference(get_object_hash(*a_obj)));
1558 + : lookup_commit_reference(a_obj->oid.hash));
1559 b = (b_obj->type == OBJ_COMMIT
1560 ? (struct commit *)b_obj
1561 - : lookup_commit_reference(get_object_hash(*b_obj)));
1561 + : lookup_commit_reference(b_obj->oid.hash));
1562 if (!a || !b)
1563 goto missing;
1564 exclude = get_merge_bases(a, b);
@@ -2938,7 +2938,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
2938 if (opt->show_notes) {
2939 if (!buf.len)
2940 strbuf_addstr(&buf, message);
2941 - format_display_notes(get_object_hash(commit->object), &buf, encoding, 1);
2941 + format_display_notes(commit->object.oid.hash, &buf, encoding, 1);
2942 }
2943
2944 /*
@@ -2968,7 +2968,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
2968 {
2969 if (commit->object.flags & SHOWN)
2970 return commit_ignore;
2971 - if (revs->unpacked && has_sha1_pack(get_object_hash(commit->object)))
2971 + if (revs->unpacked && has_sha1_pack(commit->object.oid.hash))
2972 return commit_ignore;
2973 if (revs->show_all)
2974 return commit_show;
sequencer.c
+9 -9
@@ -346,7 +346,7 @@ static int is_index_unchanged(void)
346 if (cache_tree_update(&the_index, 0))
347 return error(_("Unable to update cache tree\n"));
348
349 - return !hashcmp(active_cache_tree->sha1, get_object_hash(head_commit->tree->object));
349 + return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.oid.hash);
350 }
351
352 /*
@@ -403,12 +403,12 @@ static int is_original_commit_empty(struct commit *commit)
403 if (parse_commit(parent))
404 return error(_("Could not parse parent commit %s\n"),
405 oid_to_hex(&parent->object.oid));
406 - ptree_sha1 = get_object_hash(parent->tree->object);
406 + ptree_sha1 = parent->tree->object.oid.hash;
407 } else {
408 ptree_sha1 = EMPTY_TREE_SHA1_BIN; /* commit is root */
409 }
410
411 - return !hashcmp(ptree_sha1, get_object_hash(commit->tree->object));
411 + return !hashcmp(ptree_sha1, commit->tree->object.oid.hash);
412 }
413
414 /*
@@ -503,9 +503,9 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
503 parent = commit->parents->item;
504
505 if (opts->allow_ff &&
506 - ((parent && !hashcmp(get_object_hash(parent->object), head)) ||
506 + ((parent && !hashcmp(parent->object.oid.hash, head)) ||
507 (!parent && unborn)))
508 - return fast_forward_to(get_object_hash(commit->object), head, unborn, opts);
508 + return fast_forward_to(commit->object.oid.hash, head, unborn, opts);
509
510 if (parent && parse_commit(parent) < 0)
511 /* TRANSLATORS: The first %s will be "revert" or
@@ -592,17 +592,17 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
592 * write it at all.
593 */
594 if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
595 - update_ref(NULL, "CHERRY_PICK_HEAD", get_object_hash(commit->object), NULL,
595 + update_ref(NULL, "CHERRY_PICK_HEAD", commit->object.oid.hash, NULL,
596 REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
597 if (opts->action == REPLAY_REVERT && ((opts->no_commit && res == 0) || res == 1))
598 - update_ref(NULL, "REVERT_HEAD", get_object_hash(commit->object), NULL,
598 + update_ref(NULL, "REVERT_HEAD", commit->object.oid.hash, NULL,
599 REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
600
601 if (res) {
602 error(opts->action == REPLAY_REVERT
603 ? _("could not revert %s... %s")
604 : _("could not apply %s... %s"),
605 - find_unique_abbrev(get_object_hash(commit->object), DEFAULT_ABBREV),
605 + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV),
606 msg.subject);
607 print_advice(res == 1, opts);
608 rerere(opts->allow_rerere_auto);
@@ -664,7 +664,7 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
664
665 for (cur = todo_list; cur; cur = cur->next) {
666 const char *commit_buffer = get_commit_buffer(cur->item, NULL);
667 - sha1_abbrev = find_unique_abbrev(get_object_hash(cur->item->object), DEFAULT_ABBREV);
667 + sha1_abbrev = find_unique_abbrev(cur->item->object.oid.hash, DEFAULT_ABBREV);
668 subject_len = find_commit_subject(commit_buffer, &subject);
669 strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
670 subject_len, subject);
sha1_name.c
+8 -8
@@ -616,13 +616,13 @@ static int get_parent(const char *name, int len,
616 if (parse_commit(commit))
617 return -1;
618 if (!idx) {
619 - hashcpy(result, get_object_hash(commit->object));
619 + hashcpy(result, commit->object.oid.hash);
620 return 0;
621 }
622 p = commit->parents;
623 while (p) {
624 if (!--idx) {
625 - hashcpy(result, get_object_hash(p->item->object));
625 + hashcpy(result, p->item->object.oid.hash);
626 return 0;
627 }
628 p = p->next;
@@ -649,7 +649,7 @@ static int get_nth_ancestor(const char *name, int len,
649 return -1;
650 commit = commit->parents->item;
651 }
652 - hashcpy(result, get_object_hash(commit->object));
652 + hashcpy(result, commit->object.oid.hash);
653 return 0;
654 }
655
@@ -659,7 +659,7 @@ struct object *peel_to_type(const char *name, int namelen,
659 if (name && !namelen)
660 namelen = strlen(name);
661 while (1) {
662 - if (!o || (!o->parsed && !parse_object(get_object_hash(*o))))
662 + if (!o || (!o->parsed && !parse_object(o->oid.hash)))
663 return NULL;
664 if (expected_type == OBJ_ANY || o->type == expected_type)
665 return o;
@@ -736,7 +736,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
736 return -1;
737 if (!expected_type) {
738 o = deref_tag(o, name, sp - name - 2);
739 - if (!o || (!o->parsed && !parse_object(get_object_hash(*o))))
739 + if (!o || (!o->parsed && !parse_object(o->oid.hash)))
740 return -1;
741 hashcpy(sha1, o->oid.hash);
742 return 0;
@@ -751,7 +751,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
751 if (!o)
752 return -1;
753
754 - hashcpy(sha1, get_object_hash(*o));
754 + hashcpy(sha1, o->oid.hash);
755 if (sp[0] == '/') {
756 /* "$commit^{/foo}" */
757 char *prefix;
@@ -899,7 +899,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
899 int matches;
900
901 commit = pop_most_recent_commit(&list, ONELINE_SEEN);
902 - if (!parse_object(get_object_hash(commit->object)))
902 + if (!parse_object(commit->object.oid.hash))
903 continue;
904 buf = get_commit_buffer(commit, NULL);
905 p = strstr(buf, "\n\n");
@@ -907,7 +907,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1,
907 unuse_commit_buffer(commit, buf);
908
909 if (matches) {
910 - hashcpy(sha1, get_object_hash(commit->object));
910 + hashcpy(sha1, commit->object.oid.hash);
911 found = 1;
912 break;
913 }
shallow.c
+1 -1
@@ -105,7 +105,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
105 cur_depth++;
106 if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
107 (is_repository_shallow() && !commit->parents &&
108 - (graft = lookup_commit_graft(get_object_hash(commit->object))) != NULL &&
108 + (graft = lookup_commit_graft(commit->object.oid.hash)) != NULL &&
109 graft->nr_parent < 0)) {
110 commit_list_insert(commit, &result);
111 commit->object.flags |= shallow_flag;
submodule.c
+1 -1
@@ -597,7 +597,7 @@ static void calculate_changed_submodule_paths(void)
597 diff_opts.output_format |= DIFF_FORMAT_CALLBACK;
598 diff_opts.format_callback = submodule_collect_changed_cb;
599 diff_setup_done(&diff_opts);
600 - diff_tree_sha1(get_object_hash(parent->item->object), get_object_hash(commit->object), "", &diff_opts);
600 + diff_tree_sha1(parent->item->object.oid.hash, commit->object.oid.hash, "", &diff_opts);
601 diffcore_std(&diff_opts);
602 diff_flush(&diff_opts);
603 parent = parent->next;
tag.c
+3 -3
@@ -10,7 +10,7 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
10 {
11 while (o && o->type == OBJ_TAG)
12 if (((struct tag *)o)->tagged)
13 - o = parse_object(get_object_hash(*((struct tag *)o)->tagged));
13 + o = parse_object(((struct tag *)o)->tagged->oid.hash);
14 else
15 o = NULL;
16 if (!o && warn) {
@@ -24,7 +24,7 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen)
24 struct object *deref_tag_noverify(struct object *o)
25 {
26 while (o && o->type == OBJ_TAG) {
27 - o = parse_object(get_object_hash(*o));
27 + o = parse_object(o->oid.hash);
28 if (o && o->type == OBJ_TAG && ((struct tag *)o)->tagged)
29 o = ((struct tag *)o)->tagged;
30 else
@@ -127,7 +127,7 @@ int parse_tag(struct tag *item)
127
128 if (item->object.parsed)
129 return 0;
130 - data = read_sha1_file(get_object_hash(item->object), &type, &size);
130 + data = read_sha1_file(item->object.oid.hash, &type, &size);
131 if (!data)
132 return error("Could not read %s",
133 oid_to_hex(&item->object.oid));
test-match-trees.c
+1 -1
@@ -17,7 +17,7 @@ int main(int ac, char **av)
17 if (!two)
18 die("not a tree-ish %s", av[2]);
19
20 - shift_tree(get_object_hash(one->object), get_object_hash(two->object), shifted, -1);
20 + shift_tree(one->object.oid.hash, two->object.oid.hash, shifted, -1);
21 printf("shifted: %s\n", sha1_to_hex(shifted));
22
23 exit(0);
tree.c
+2 -2
@@ -102,7 +102,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,
102 sha1_to_hex(entry.sha1),
103 base->buf, entry.path);
104
105 - hashcpy(sha1, get_object_hash(commit->tree->object));
105 + hashcpy(sha1, commit->tree->object.oid.hash);
106 }
107 else
108 continue;
@@ -212,7 +212,7 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)
212
213 if (item->object.parsed)
214 return 0;
215 - buffer = read_sha1_file(get_object_hash(item->object), &type, &size);
215 + buffer = read_sha1_file(item->object.oid.hash, &type, &size);
216 if (!buffer)
217 return quiet_on_missing ? -1 :
218 error("Could not read %s",
upload-pack.c
+5 -5
@@ -324,7 +324,7 @@ static int reachable(struct commit *want)
324 break;
325 }
326 if (!commit->object.parsed)
327 - parse_object(get_object_hash(commit->object));
327 + parse_object(commit->object.oid.hash);
328 if (commit->object.flags & REACHABLE)
329 continue;
330 commit->object.flags |= REACHABLE;
@@ -647,7 +647,7 @@ static void receive_needs(void)
647 if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
648 packet_write(1, "shallow %s",
649 oid_to_hex(&object->oid));
650 - register_shallow(get_object_hash(*object));
650 + register_shallow(object->oid.hash);
651 shallow_nr++;
652 }
653 result = result->next;
@@ -661,7 +661,7 @@ static void receive_needs(void)
661 oid_to_hex(&object->oid));
662 object->flags &= ~CLIENT_SHALLOW;
663 /* make sure the real parents are parsed */
664 - unregister_shallow(get_object_hash(*object));
664 + unregister_shallow(object->oid.hash);
665 object->parsed = 0;
666 parse_commit_or_die((struct commit *)object);
667 parents = ((struct commit *)object)->parents;
@@ -673,14 +673,14 @@ static void receive_needs(void)
673 add_object_array(object, NULL, &extra_edge_obj);
674 }
675 /* make sure commit traversal conforms to client */
676 - register_shallow(get_object_hash(*object));
676 + register_shallow(object->oid.hash);
677 }
678 packet_flush(1);
679 } else
680 if (shallows.nr > 0) {
681 int i;
682 for (i = 0; i < shallows.nr; i++)
683 - register_shallow(get_object_hash(*shallows.objects[i].item));
683 + register_shallow(shallows.objects[i].item->oid.hash);
684 }
685
686 shallow_nr += shallows.nr;
walker.c
+4 -4
@@ -78,7 +78,7 @@ static int process_commit(struct walker *walker, struct commit *commit)
78 if (commit->object.flags & COMPLETE)
79 return 0;
80
81 - hashcpy(current_commit_sha1, get_object_hash(commit->object));
81 + hashcpy(current_commit_sha1, commit->object.oid.hash);
82
83 walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
84
@@ -146,7 +146,7 @@ static int process(struct walker *walker, struct object *obj)
146 else {
147 if (obj->flags & COMPLETE)
148 return 0;
149 - walker->prefetch(walker, get_object_hash(*obj));
149 + walker->prefetch(walker, obj->oid.hash);
150 }
151
152 object_list_insert(obj, process_queue_end);
@@ -170,13 +170,13 @@ static int loop(struct walker *walker)
170 * the queue because we needed to fetch it first.
171 */
172 if (! (obj->flags & TO_SCAN)) {
173 - if (walker->fetch(walker, get_object_hash(*obj))) {
173 + if (walker->fetch(walker, obj->oid.hash)) {
174 report_missing(obj);
175 return -1;
176 }
177 }
178 if (!obj->type)
179 - parse_object(get_object_hash(*obj));
179 + parse_object(obj->oid.hash);
180 if (process_object(walker, obj))
181 return -1;
182 }
wt-status.c
+1 -1
@@ -1347,7 +1347,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
1347 (!hashcmp(cb.nsha1, sha1) ||
1348 /* perhaps sha1 is a tag, try to dereference to a commit */
1349 ((commit = lookup_commit_reference_gently(sha1, 1)) != NULL &&
1350 - !hashcmp(cb.nsha1, get_object_hash(commit->object))))) {
1350 + !hashcmp(cb.nsha1, commit->object.oid.hash)))) {
1351 const char *from = ref;
1352 if (!skip_prefix(from, "refs/tags/", &from))
1353 skip_prefix(from, "refs/remotes/", &from);