summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-28 21:22:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-29 18:32:49 (GMT)
commit9001dc2a7493f1366a183c3a9175f608769321d5 (patch)
tree58340f7fbbbf2c49b376c43beac13ab7e39bf5dd /fast-import.c
parente3ff0683e22070ce42c3c373f6e89e9dc38b756c (diff)
downloadgit-9001dc2a7493f1366a183c3a9175f608769321d5.zip
git-9001dc2a7493f1366a183c3a9175f608769321d5.tar.gz
git-9001dc2a7493f1366a183c3a9175f608769321d5.tar.bz2
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 'fast-import.c')
-rw-r--r--fast-import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fast-import.c b/fast-import.c
index a731088..67a53b7 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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;
}