]> git.ipfire.org Git - thirdparty/git.git/commitdiff
convert "oidcmp() != 0" to "!oideq()"
authorJeff King <peff@peff.net>
Tue, 28 Aug 2018 21:22:48 +0000 (17:22 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Aug 2018 18:32:49 +0000 (11:32 -0700)
This is the flip side of the previous two patches: checking
for a non-zero oidcmp() can be more strictly expressed as
inequality. Like those patches, we write "!= 0" in the
coccinelle transformation, which covers by isomorphism the
more common:

  if (oidcmp(E1, E2))

As with the previous two patches, this patch can be achieved
almost entirely by running "make coccicheck"; the only
differences are manual line-wrap fixes to match the original
code.

There is one thing to note for anybody replicating this,
though: coccinelle 1.0.4 seems to miss the case in
builtin/tag.c, even though it's basically the same as all
the others. Running with 1.0.7 does catch this, so
presumably it's just a coccinelle bug that was fixed in the
interim.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
31 files changed:
bisect.c
blame.c
builtin/fmt-merge-msg.c
builtin/merge.c
builtin/pull.c
builtin/rm.c
builtin/show-branch.c
builtin/tag.c
bundle.c
commit-graph.c
commit.c
contrib/coccinelle/object_id.cocci
diff-lib.c
diff.c
diffcore-rename.c
dir.c
fast-import.c
fetch-pack.c
match-trees.c
notes.c
read-cache.c
refs.c
refs/files-backend.c
refs/packed-backend.c
refs/ref-cache.c
remote.c
sequencer.c
sha1-file.c
submodule-config.c
t/helper/test-dump-cache-tree.c
tree-diff.c

index 41c56a665ec5c228f21f8d14ae27c43314f5d6fb..7c1d8f1a6dbb6f08b003ad858889c4d59e204923 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -595,7 +595,7 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
 
        for (i = 0; cur; cur = cur->next, i++) {
                if (i == index) {
-                       if (oidcmp(&cur->item->object.oid, current_bad_oid))
+                       if (!oideq(&cur->item->object.oid, current_bad_oid))
                                return cur;
                        if (previous)
                                return previous;
diff --git a/blame.c b/blame.c
index c47d7050d91a4312d3cb1b662708f3883862d2c2..d5f7b7237c4e9f9dcb6ad37504a98a0fcff66f80 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -1832,7 +1832,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
 
                sb->revs->children.name = "children";
                while (c->parents &&
-                      oidcmp(&c->object.oid, &sb->final->object.oid)) {
+                      !oideq(&c->object.oid, &sb->final->object.oid)) {
                        struct commit_list *l = xcalloc(1, sizeof(*l));
 
                        l->item = c;
@@ -1842,7 +1842,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
                        c = c->parents->item;
                }
 
-               if (oidcmp(&c->object.oid, &sb->final->object.oid))
+               if (!oideq(&c->object.oid, &sb->final->object.oid))
                        die(_("--reverse --first-parent together require range along first-parent chain"));
        }
 
index 4c82c234cbf2d21c9d632f5494e8265cc351fab9..268f0c20ca8a17ae595ca363e421c0f814be956a 100644 (file)
@@ -78,9 +78,9 @@ static struct merge_parent *find_merge_parent(struct merge_parents *table,
 {
        int i;
        for (i = 0; i < table->nr; i++) {
-               if (given && oidcmp(&table->item[i].given, given))
+               if (given && !oideq(&table->item[i].given, given))
                        continue;
-               if (commit && oidcmp(&table->item[i].commit, commit))
+               if (commit && !oideq(&table->item[i].commit, commit))
                        continue;
                return &table->item[i];
        }
index 57abff999b429899e69835baff188e2f3f25f9f8..8d85d31a61b8fbb53b04a9f506c0d7aca93e35d9 100644 (file)
@@ -1521,7 +1521,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                         * HEAD^^" would be missed.
                         */
                        common_one = get_merge_bases(head_commit, j->item);
-                       if (oidcmp(&common_one->item->object.oid, &j->item->object.oid)) {
+                       if (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {
                                up_to_date = 0;
                                break;
                        }
index a720f58a969dc5c9b3dbed9ef37878498fbbc677..09b02695de682bf41bcbe3ef51c1179b69e105de 100644 (file)
@@ -902,7 +902,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
                oidclr(&curr_head);
 
        if (!is_null_oid(&orig_head) && !is_null_oid(&curr_head) &&
-                       oidcmp(&orig_head, &curr_head)) {
+                       !oideq(&orig_head, &curr_head)) {
                /*
                 * The fetch involved updating the current branch.
                 *
index 2cbe89e0ae3b7a4801ac27d25fd37306813104ba..17086d3d97c536522720c589ea8f35d366536ea8 100644 (file)
@@ -180,7 +180,7 @@ static int check_local_mod(struct object_id *head, int index_only)
                if (no_head
                     || get_tree_entry(head, name, &oid, &mode)
                     || ce->ce_mode != create_ce_mode(mode)
-                    || oidcmp(&ce->oid, &oid))
+                    || !oideq(&ce->oid, &oid))
                        staged_changes = 1;
 
                /*
index 363cf8509af5bf640da60c36118b841da06918fe..5f9432861bdc4326a58cebfc05fdb96a9b3a7616 100644 (file)
@@ -412,7 +412,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
        /* If both heads/foo and tags/foo exists, get_sha1 would
         * get confused.
         */
-       if (get_oid(refname + ofs, &tmp) || oidcmp(&tmp, oid))
+       if (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))
                ofs = 5;
        return append_ref(refname + ofs, oid, 0);
 }
@@ -427,7 +427,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,
        /* If both heads/foo and tags/foo exists, get_sha1 would
         * get confused.
         */
-       if (get_oid(refname + ofs, &tmp) || oidcmp(&tmp, oid))
+       if (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))
                ofs = 5;
        return append_ref(refname + ofs, oid, 0);
 }
index 9a19ffb49f68d7c0318f650d34d0edbcd6db81d3..f6236321865773cb60907bfe8b56d96bbaf3e83a 100644 (file)
@@ -559,7 +559,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
            ref_transaction_commit(transaction, &err))
                die("%s", err.buf);
        ref_transaction_free(transaction);
-       if (force && !is_null_oid(&prev) && oidcmp(&prev, &object))
+       if (force && !is_null_oid(&prev) && !oideq(&prev, &object))
                printf(_("Updated tag '%s' (was %s)\n"), tag,
                       find_unique_abbrev(&prev, DEFAULT_ABBREV));
 
index 24cbe409863a83e8bda453af637c2237504a531d..14f2cfc24836b4a526df935e83d8e5899055f483 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -369,7 +369,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                 * commit that is referenced by the tag, and not the tag
                 * itself.
                 */
-               if (oidcmp(&oid, &e->item->oid)) {
+               if (!oideq(&oid, &e->item->oid)) {
                        /*
                         * Is this the positive end of a range expressed
                         * in terms of a tag (e.g. v2.0 from the range
index 050c516b0de664f8ce98a2c5a74fe2d7c6295f45..7aed9f53714a7623e319856b76ddb1d6498ec4d4 100644 (file)
@@ -765,7 +765,7 @@ void write_commit_graph(const char *obj_dir,
 
        count_distinct = 1;
        for (i = 1; i < oids.nr; i++) {
-               if (oidcmp(&oids.list[i-1], &oids.list[i]))
+               if (!oideq(&oids.list[i - 1], &oids.list[i]))
                        count_distinct++;
        }
 
@@ -960,7 +960,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
                        continue;
                }
 
-               if (oidcmp(&get_commit_tree_in_graph_one(g, graph_commit)->object.oid,
+               if (!oideq(&get_commit_tree_in_graph_one(g, graph_commit)->object.oid,
                           get_commit_tree_oid(odb_commit)))
                        graph_report("root tree OID for commit %s in commit-graph is %s != %s",
                                     oid_to_hex(&cur_oid),
@@ -977,7 +977,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g)
                                break;
                        }
 
-                       if (oidcmp(&graph_parents->item->object.oid, &odb_parents->item->object.oid))
+                       if (!oideq(&graph_parents->item->object.oid, &odb_parents->item->object.oid))
                                graph_report("commit-graph parent for %s is %s != %s",
                                             oid_to_hex(&cur_oid),
                                             oid_to_hex(&graph_parents->item->object.oid),
index 1a6e632185346f518ed389f2d479c807a5f49927..1b94a8c96fa6cd87531846be9a50fa30d890aa50 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -46,7 +46,7 @@ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref
        struct commit *c = lookup_commit_reference(the_repository, oid);
        if (!c)
                die(_("could not parse %s"), ref_name);
-       if (oidcmp(oid, &c->object.oid)) {
+       if (!oideq(oid, &c->object.oid)) {
                warning(_("%s %s is not a commit!"),
                        ref_name, oid_to_hex(oid));
        }
index d90ba8a0400b81cac8088bce10ed5b6a082e6402..4e1f1a74315419316bb374d33377dfb91467a731 100644 (file)
@@ -123,3 +123,9 @@ expression E1, E2;
 - hashcmp(E1, E2) == 0
 + hasheq(E1, E2)
   ...>}
+
+@@
+expression E1, E2;
+@@
+- oidcmp(E1, E2) != 0
++ !oideq(E1, E2)
index c1f5a5265433abe1d011d46c69d8d97316ce2fda..8866b1d60c0e390160f5cbc5bee1189736775e52 100644 (file)
@@ -342,7 +342,7 @@ static int show_modified(struct rev_info *revs,
        }
 
        if (revs->combine_merges && !cached &&
-           (oidcmp(oid, &old_entry->oid) || oidcmp(&old_entry->oid, &new_entry->oid))) {
+           (!oideq(oid, &old_entry->oid) || !oideq(&old_entry->oid, &new_entry->oid))) {
                struct combine_diff_path *p;
                int pathlen = ce_namelen(new_entry);
 
diff --git a/diff.c b/diff.c
index 5cada68267381d76433020411298240a4e91da15..5d3219b600e0d2818ed693ce4c5be8961044a533 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3765,7 +3765,7 @@ static int reuse_worktree_file(const char *name, const struct object_id *oid, in
         * This is not the sha1 we are looking for, or
         * unreusable because it is not a regular file.
         */
-       if (oidcmp(oid, &ce->oid) || !S_ISREG(ce->ce_mode))
+       if (!oideq(oid, &ce->oid) || !S_ISREG(ce->ce_mode))
                return 0;
 
        /*
@@ -4170,7 +4170,7 @@ static void fill_metainfo(struct strbuf *msg,
        default:
                *must_show_header = 0;
        }
-       if (one && two && oidcmp(&one->oid, &two->oid)) {
+       if (one && two && !oideq(&one->oid, &two->oid)) {
                const unsigned hexsz = the_hash_algo->hexsz;
                int abbrev = o->flags.full_index ? hexsz : DEFAULT_ABBREV;
 
@@ -5457,7 +5457,7 @@ static void diff_resolve_rename_copy(void)
                        else
                                p->status = DIFF_STATUS_RENAMED;
                }
-               else if (oidcmp(&p->one->oid, &p->two->oid) ||
+               else if (!oideq(&p->one->oid, &p->two->oid) ||
                         p->one->mode != p->two->mode ||
                         p->one->dirty_submodule ||
                         p->two->dirty_submodule ||
index d775183c2fd1bed06a97facb56c4721e4e5df2f6..daddd9b28af1e20fe82aefa654bad04f4b52c1d3 100644 (file)
@@ -286,7 +286,7 @@ static int find_identical_files(struct hashmap *srcs,
                struct diff_filespec *source = p->filespec;
 
                /* False hash collision? */
-               if (oidcmp(&source->oid, &target->oid))
+               if (!oideq(&source->oid, &target->oid))
                        continue;
                /* Non-regular files? If so, the modes must match! */
                if (!S_ISREG(source->mode) || !S_ISREG(target->mode)) {
diff --git a/dir.c b/dir.c
index aceb0d48692b7d727cfd2645ae88b0d45d660c09..8ee9fe81b460c39d071e55e89421fd747afe115d 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1282,7 +1282,7 @@ static void prep_exclude(struct dir_struct *dir,
                 * order, though, if you do that.
                 */
                if (untracked &&
-                   oidcmp(&oid_stat.oid, &untracked->exclude_oid)) {
+                   !oideq(&oid_stat.oid, &untracked->exclude_oid)) {
                        invalidate_gitignore(dir->untracked, untracked);
                        oidcpy(&untracked->exclude_oid, &oid_stat.oid);
                }
@@ -2248,12 +2248,12 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
 
        /* Validate $GIT_DIR/info/exclude and core.excludesfile */
        root = dir->untracked->root;
-       if (oidcmp(&dir->ss_info_exclude.oid,
+       if (!oideq(&dir->ss_info_exclude.oid,
                   &dir->untracked->ss_info_exclude.oid)) {
                invalidate_gitignore(dir->untracked, root);
                dir->untracked->ss_info_exclude = dir->ss_info_exclude;
        }
-       if (oidcmp(&dir->ss_excludes_file.oid,
+       if (!oideq(&dir->ss_excludes_file.oid,
                   &dir->untracked->ss_excludes_file.oid)) {
                invalidate_gitignore(dir->untracked, root);
                dir->untracked->ss_excludes_file = dir->ss_excludes_file;
index a731088f96919909d8cdc4122954cf97e411578c..67a53b79cb17388863ec2c0c17c0aea3d1d01358 100644 (file)
@@ -2649,7 +2649,7 @@ static int parse_from(struct branch *b)
                struct object_entry *oe = find_mark(idnum);
                if (oe->type != OBJ_COMMIT)
                        die("Mark :%" PRIuMAX " not a commit", idnum);
-               if (oidcmp(&b->oid, &oe->idx.oid)) {
+               if (!oideq(&b->oid, &oe->idx.oid)) {
                        oidcpy(&b->oid, &oe->idx.oid);
                        if (oe->pack_id != MAX_PACK_ID) {
                                unsigned long size;
@@ -2667,7 +2667,7 @@ static int parse_from(struct branch *b)
        else
                die("Invalid ref name or SHA1 expression: %s", from);
 
-       if (b->branch_tree.tree && oidcmp(&oid, &b->branch_tree.versions[1].oid)) {
+       if (b->branch_tree.tree && !oideq(&oid, &b->branch_tree.versions[1].oid)) {
                release_tree_content_recursive(b->branch_tree.tree);
                b->branch_tree.tree = NULL;
        }
index 88a078e9befd281cf5f03e9e64615b14ca768a35..75047a4b2a491e805f7c500dc804e78a8538bfa2 100644 (file)
@@ -599,7 +599,7 @@ static void filter_refs(struct fetch_pack_args *args,
                        continue;
                if (parse_oid_hex(ref->name, &oid, &p) ||
                    *p != '\0' ||
-                   oidcmp(&oid, &ref->old_oid))
+                   !oideq(&oid, &ref->old_oid))
                        continue;
 
                if ((allow_unadvertised_object_request &
index 37653308d3601e56191d2f83f967cc77ad1517af..2b6d31ef9d35d9422e7ef90792651dcb7a2f9189 100644 (file)
@@ -106,7 +106,7 @@ static int score_trees(const struct object_id *hash1, const struct object_id *ha
                        update_tree_entry(&two);
                } else {
                        /* path appears in both */
-                       if (oidcmp(one.entry.oid, two.entry.oid)) {
+                       if (!oideq(one.entry.oid, two.entry.oid)) {
                                /* they are different */
                                score += score_differs(one.entry.mode,
                                                       two.entry.mode,
diff --git a/notes.c b/notes.c
index 33d16c1ec30c7a904019a37c4262bfd3207b0b94..25cdce28b71a3ff15da424c8d1b1a89e28356dd5 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -206,7 +206,7 @@ static void note_tree_remove(struct notes_tree *t,
        if (GET_PTR_TYPE(*p) != PTR_TYPE_NOTE)
                return; /* type mismatch, nothing to remove */
        l = (struct leaf_node *) CLR_PTR_TYPE(*p);
-       if (oidcmp(&l->key_oid, &entry->key_oid))
+       if (!oideq(&l->key_oid, &entry->key_oid))
                return; /* key mismatch, nothing to remove */
 
        /* we have found a matching entry */
index eb4919e77fa248e379408b8e0f62dfc0a0e5dbbb..88bb80326bf5871d42906d9666b6646d2d38d3f5 100644 (file)
@@ -2029,7 +2029,7 @@ int read_index_from(struct index_state *istate, const char *path,
        base_oid_hex = oid_to_hex(&split_index->base_oid);
        base_path = xstrfmt("%s/sharedindex.%s", gitdir, base_oid_hex);
        ret = do_read_index(split_index->base, base_path, 1);
-       if (oidcmp(&split_index->base_oid, &split_index->base->oid))
+       if (!oideq(&split_index->base_oid, &split_index->base->oid))
                die("broken index, expect %s in %s, got %s",
                    base_oid_hex, base_path,
                    oid_to_hex(&split_index->base->oid));
diff --git a/refs.c b/refs.c
index de81c7be7ca8d3ca033b34a61f33b0bff069932f..a7a75b4cc0b9b93ec3a56340a711900c76b506ce 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -702,7 +702,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
                                    pseudoref);
                        rollback_lock_file(&lock);
                        goto done;
-               } else if (oidcmp(&actual_old_oid, old_oid)) {
+               } else if (!oideq(&actual_old_oid, old_oid)) {
                        strbuf_addf(err, _("unexpected object ID when writing '%s'"),
                                    pseudoref);
                        rollback_lock_file(&lock);
@@ -744,7 +744,7 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
                }
                if (read_ref(pseudoref, &actual_old_oid))
                        die(_("could not read ref '%s'"), pseudoref);
-               if (oidcmp(&actual_old_oid, old_oid)) {
+               if (!oideq(&actual_old_oid, old_oid)) {
                        error(_("unexpected object ID when deleting '%s'"),
                              pseudoref);
                        rollback_lock_file(&lock);
@@ -875,13 +875,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
                 */
                if (!is_null_oid(&cb->ooid)) {
                        oidcpy(cb->oid, noid);
-                       if (oidcmp(&cb->ooid, noid))
+                       if (!oideq(&cb->ooid, noid))
                                warning(_("log for ref %s has gap after %s"),
                                        cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
                }
                else if (cb->date == cb->at_time)
                        oidcpy(cb->oid, noid);
-               else if (oidcmp(noid, cb->oid))
+               else if (!oideq(noid, cb->oid))
                        warning(_("log for ref %s unexpectedly ended on %s"),
                                cb->refname, show_date(cb->date, cb->tz,
                                                       DATE_MODE(RFC2822)));
index aa45f5317fa635be694e67a069a67df1f6a35401..16ef9325e0d9985c36fd525016340246caaa1af8 100644 (file)
@@ -841,7 +841,7 @@ static int verify_lock(struct ref_store *ref_store, struct ref_lock *lock,
                        return 0;
                }
        }
-       if (old_oid && oidcmp(&lock->old_oid, old_oid)) {
+       if (old_oid && !oideq(&lock->old_oid, old_oid)) {
                strbuf_addf(err, "ref '%s' is at %s but expected %s",
                            lock->ref_name,
                            oid_to_hex(&lock->old_oid),
index d447a731da0932e60c918030c7cd07a1843dfd35..74e2996e93ad0033bd4650f8dd7d894a46d563b3 100644 (file)
@@ -1160,7 +1160,7 @@ static int write_with_updates(struct packed_ref_store *refs,
                                                    "reference already exists",
                                                    update->refname);
                                        goto error;
-                               } else if (oidcmp(&update->old_oid, iter->oid)) {
+                               } else if (!oideq(&update->old_oid, iter->oid)) {
                                        strbuf_addf(err, "cannot update ref '%s': "
                                                    "is at %s but expected %s",
                                                    update->refname,
index 9b110c8494ff802fea730570f8c8f3b522292dbf..b7052f72e2f4e61ea9f2bba5efee262e6db8fd4a 100644 (file)
@@ -272,7 +272,7 @@ static int is_dup_ref(const struct ref_entry *ref1, const struct ref_entry *ref2
                /* This is impossible by construction */
                die("Reference directory conflict: %s", ref1->name);
 
-       if (oidcmp(&ref1->u.value.oid, &ref2->u.value.oid))
+       if (!oideq(&ref1->u.value.oid, &ref2->u.value.oid))
                die("Duplicated ref, and SHA1s don't match: %s", ref1->name);
 
        warning("Duplicated ref: %s", ref1->name);
index 6f1ee9d64019948b30908780d93dccd0232cb932..e23b7675c889e5052add668f986fcd0cb7904e3a 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1403,7 +1403,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
                 * branch.
                 */
                if (ref->expect_old_sha1) {
-                       if (oidcmp(&ref->old_oid, &ref->old_oid_expect))
+                       if (!oideq(&ref->old_oid, &ref->old_oid_expect))
                                reject_reason = REF_STATUS_REJECT_STALE;
                        else
                                /* If the ref isn't stale then force the update. */
index 5f823c9ec7754df82d1cc8140c9a72ce322c1420..b14e5dc13ce17b215e44f58aafaeb47dd8e56681 100644 (file)
@@ -1188,7 +1188,7 @@ static int parse_head(struct commit **head)
                current_head = lookup_commit_reference(the_repository, &oid);
                if (!current_head)
                        return error(_("could not parse HEAD"));
-               if (oidcmp(&oid, &current_head->object.oid)) {
+               if (!oideq(&oid, &current_head->object.oid)) {
                        warning(_("HEAD %s is not a commit!"),
                                oid_to_hex(&oid));
                }
@@ -3034,7 +3034,7 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
                struct commit_list *p = commit->parents->next;
 
                for (j = to_merge; j && p; j = j->next, p = p->next)
-                       if (oidcmp(&j->item->object.oid,
+                       if (!oideq(&j->item->object.oid,
                                   &p->item->object.oid)) {
                                can_fast_forward = 0;
                                break;
@@ -3566,7 +3566,7 @@ static int commit_staged_changes(struct replay_opts *opts,
                if (get_oid_hex(rev.buf, &to_amend))
                        return error(_("invalid contents: '%s'"),
                                rebase_path_amend());
-               if (!is_clean && oidcmp(&head, &to_amend))
+               if (!is_clean && !oideq(&head, &to_amend))
                        return error(_("\nYou have uncommitted changes in your "
                                       "working tree. Please, commit them\n"
                                       "first and then run 'git rebase "
@@ -4545,7 +4545,7 @@ int skip_unnecessary_picks(void)
                if (item->commit->parents->next)
                        break; /* merge commit */
                parent_oid = &item->commit->parents->item->object.oid;
-               if (oidcmp(parent_oid, oid))
+               if (!oideq(parent_oid, oid))
                        break;
                oid = &item->commit->object.oid;
        }
index 71f49ee56db0ebb6bced8927dcee632388f5546a..cc8a1963498c78ec56171f79c4c1c2d426bd12ba 100644 (file)
@@ -825,7 +825,7 @@ int check_object_signature(const struct object_id *oid, void *map,
 
        if (map) {
                hash_object_file(map, size, type, &real_oid);
-               return oidcmp(oid, &real_oid) ? -1 : 0;
+               return !oideq(oid, &real_oid) ? -1 : 0;
        }
 
        st = open_istream(oid, &obj_type, &size, NULL);
@@ -852,7 +852,7 @@ int check_object_signature(const struct object_id *oid, void *map,
        }
        the_hash_algo->final_fn(real_oid.hash, &c);
        close_istream(st);
-       return oidcmp(oid, &real_oid) ? -1 : 0;
+       return !oideq(oid, &real_oid) ? -1 : 0;
 }
 
 int git_open_cloexec(const char *name, int flags)
@@ -1671,7 +1671,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
                die(_("deflateEnd on object %s failed (%d)"), oid_to_hex(oid),
                    ret);
        the_hash_algo->final_fn(parano_oid.hash, &c);
-       if (oidcmp(oid, &parano_oid) != 0)
+       if (!oideq(oid, &parano_oid))
                die(_("confused by unstable object source data for %s"),
                    oid_to_hex(oid));
 
index fc2c41b947cb471deef42323c83f8b28f42780d6..e04ba756d954e03f4c94785f260c2ac9af6a6f9b 100644 (file)
@@ -45,7 +45,7 @@ static int config_path_cmp(const void *unused_cmp_data,
        const struct submodule_entry *b = entry_or_key;
 
        return strcmp(a->config->path, b->config->path) ||
-              oidcmp(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
+              !oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
 }
 
 static int config_name_cmp(const void *unused_cmp_data,
@@ -57,7 +57,7 @@ static int config_name_cmp(const void *unused_cmp_data,
        const struct submodule_entry *b = entry_or_key;
 
        return strcmp(a->config->name, b->config->name) ||
-              oidcmp(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
+              !oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
 }
 
 static struct submodule_cache *submodule_cache_alloc(void)
index 98a4891f1dc936a486075703de319affdacb1c78..6a3f88f5f5d4a8af09dca7c13da6132d66093ca2 100644 (file)
@@ -33,7 +33,7 @@ static int dump_cache_tree(struct cache_tree *it,
        }
        else {
                dump_one(it, pfx, "");
-               if (oidcmp(&it->oid, &ref->oid) ||
+               if (!oideq(&it->oid, &ref->oid) ||
                    ref->entry_count != it->entry_count ||
                    ref->subtree_nr != it->subtree_nr) {
                        /* claims to be valid but is lying */
index 553bc0e63ae37ada1c3e19ae748d1228561f00f6..425668e1e0b468d55e87dba69169acd53bba2c31 100644 (file)
@@ -491,7 +491,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
                                                continue;
 
                                        /* diff(t,pi) != ΓΈ */
-                                       if (oidcmp(t.entry.oid, tp[i].entry.oid) ||
+                                       if (!oideq(t.entry.oid, tp[i].entry.oid) ||
                                            (t.entry.mode != tp[i].entry.mode))
                                                continue;