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>
This commit is contained in:
committed by
Junio C Hamano
parent
e3ff0683e2
commit
9001dc2a74
@ -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));
|
||||
|
||||
Reference in New Issue
Block a user