]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
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)
commit9001dc2a7493f1366a183c3a9175f608769321d5
tree58340f7fbbbf2c49b376c43beac13ab7e39bf5dd
parente3ff0683e22070ce42c3c373f6e89e9dc38b756c
convert "oidcmp() != 0" to "!oideq()"

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