From: Jeff Smith <whydoubt@gmail.com>
To: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Cc: "Jeff King" <peff@peff.net>, "Derrick Stolee" <stolee@gmail.com>,
"René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>
Subject: Re: [PATCH] blame.c: replace instance of !oidcmp for oideq
Date: Wed, 9 Sep 2020 12:48:13 -0500 [thread overview]
Message-ID: <CAPX7N=5wRZbwWzzKmqyQGswJDFDf-DWq56pBPMSx4=fEuisskg@mail.gmail.com> (raw)
In-Reply-To: <CAOc6etZS3mGxsPPh25XFi2-qR0TNzq0Gx1NrydgQwmHbsjxejA@mail.gmail.com>
I haven't had a chance to look at the cocci script, but I did have one
thought...
Derrick pointed out, 14438c4 added both oideq and hasheq.
It might be good to have a similar check for hasheq, if there is not
one already.
On Wed, Sep 9, 2020 at 9:01 AM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:
>
> On Wed, Sep 9, 2020 at 3:11 AM Jeff King <peff@peff.net> wrote:
> >
> > Yeah, it looks obviously correct. I am puzzled why "make coccicheck"
> > doesn't find this, though. +cc René, as my favorite target for
> > coccinelle nerd-snipes. :)
> >
>
> I added this to contrib/coccinelle/object_id.cocci in v2.27.0
>
> @@
> identifier f != oideq;
> expression E1, E2;
> @@
> - !oidcmp(E1, E2)
> + oideq(E1, E2)
>
> And it found it:
>
> $ cat contrib/coccinelle/object_id.cocci.patch
> diff -u -p a/blame.c b/blame.c
> --- a/blame.c
> +++ b/blame.c
> @@ -1352,8 +1352,7 @@ static struct blame_origin *find_origin(
> else {
> int compute_diff = 1;
> if (origin->commit->parents &&
> - !oidcmp(&parent->object.oid,
> - &origin->commit->parents->item->object.oid))
> + oideq(&parent->object.oid,
> &origin->commit->parents->item->object.oid))
> compute_diff = maybe_changed_path(r, origin, bd);
>
> if (compute_diff)
>
>
> Do I need to add more things into the coccinelle definition so that it
> is more restrictive in terms of the
> expression we are hunting down?
next prev parent reply other threads:[~2020-09-09 17:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 17:16 [PATCH] blame.c: replace instance of !oidcmp for oideq Edmundo Carmona Antoranz
2020-09-07 17:21 ` Edmundo Carmona Antoranz
2020-09-08 13:55 ` Edmundo Carmona Antoranz
2020-09-08 19:07 ` Derrick Stolee
2020-09-09 9:11 ` Jeff King
2020-09-09 14:00 ` Edmundo Carmona Antoranz
2020-09-09 17:48 ` Jeff Smith [this message]
2020-09-09 19:13 ` Jeff King
2020-09-09 19:17 ` Jeff King
2020-09-09 19:54 ` René Scharfe
2020-09-09 19:58 ` Jeff King
2020-09-09 20:03 ` Junio C Hamano
2020-09-09 20:06 ` Junio C Hamano
2020-09-09 20:43 ` René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPX7N=5wRZbwWzzKmqyQGswJDFDf-DWq56pBPMSx4=fEuisskg@mail.gmail.com' \
--to=whydoubt@gmail.com \
--cc=eantoranz@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).