Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-29 00:22:48 +0300
committerJunio C Hamano <gitster@pobox.com>2018-08-29 21:32:49 +0300
commit9001dc2a7493f1366a183c3a9175f608769321d5 (patch)
tree58340f7fbbbf2c49b376c43beac13ab7e39bf5dd /refs/ref-cache.c
parente3ff0683e22070ce42c3c373f6e89e9dc38b756c (diff)
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>
Diffstat (limited to 'refs/ref-cache.c')
-rw-r--r--refs/ref-cache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs/ref-cache.c b/refs/ref-cache.c
index 9b110c8494..b7052f72e2 100644
--- a/refs/ref-cache.c
+++ b/refs/ref-cache.c
@@ -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);