summaryrefslogtreecommitdiff
path: root/sequencer.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 /sequencer.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 'sequencer.c')
-rw-r--r--sequencer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c
index 5f823c9..b14e5dc 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -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;
}