Skip to content

Commit ee56992

Browse files
committed
Merge branch 'jk/oideq-hasheq-cleanup'
Code clean-up. * jk/oideq-hasheq-cleanup: more oideq/hasheq conversions
2 parents 20f28d7 + e43d2dc commit ee56992

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

builtin/checkout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ static int skip_merge_working_tree(const struct checkout_opts *opts,
497497
* We must do the merge if we are actually moving to a new commit.
498498
*/
499499
if (!old_branch_info->commit || !new_branch_info->commit ||
500-
oidcmp(&old_branch_info->commit->object.oid, &new_branch_info->commit->object.oid))
500+
!oideq(&old_branch_info->commit->object.oid,
501+
&new_branch_info->commit->object.oid))
501502
return 0;
502503

503504
/*

cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ static void verify_one(struct index_state *istate,
781781
strbuf_add(&tree_buf, oid->hash, the_hash_algo->rawsz);
782782
}
783783
hash_object_file(tree_buf.buf, tree_buf.len, tree_type, &new_oid);
784-
if (oidcmp(&new_oid, &it->oid))
784+
if (!oideq(&new_oid, &it->oid))
785785
BUG("cache-tree for path %.*s does not match. "
786786
"Expected %s got %s", len, path->buf,
787787
oid_to_hex(&new_oid), oid_to_hex(&it->oid));

commit-reach.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ struct contains_stack {
426426
static int in_commit_list(const struct commit_list *want, struct commit *c)
427427
{
428428
for (; want; want = want->next)
429-
if (!oidcmp(&want->item->object.oid, &c->object.oid))
429+
if (oideq(&want->item->object.oid, &c->object.oid))
430430
return 1;
431431
return 0;
432432
}

midx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ static int nth_midxed_pack_entry(struct multi_pack_index *m, struct pack_entry *
282282
struct object_id oid;
283283
nth_midxed_object_oid(&oid, m, pos);
284284
for (i = 0; i < p->num_bad_objects; i++)
285-
if (!hashcmp(oid.hash,
286-
p->bad_object_sha1 + the_hash_algo->rawsz * i))
285+
if (hasheq(oid.hash,
286+
p->bad_object_sha1 + the_hash_algo->rawsz * i))
287287
return 0;
288288
}
289289

@@ -580,8 +580,8 @@ static struct pack_midx_entry *get_sorted_entries(struct multi_pack_index *m,
580580
* Take only the first duplicate.
581581
*/
582582
for (cur_object = 0; cur_object < nr_fanout; cur_object++) {
583-
if (cur_object && !oidcmp(&entries_by_fanout[cur_object - 1].oid,
584-
&entries_by_fanout[cur_object].oid))
583+
if (cur_object && oideq(&entries_by_fanout[cur_object - 1].oid,
584+
&entries_by_fanout[cur_object].oid))
585585
continue;
586586

587587
ALLOC_GROW(deduplicated_entries, *nr_objects + 1, alloc_objects);

0 commit comments

Comments
 (0)