Re: [PATCH v2 10/32] commit.c: add repo_get_commit_tree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Duy,

On Fri, 5 Apr 2019, Duy Nguyen wrote:

> On Fri, Apr 5, 2019 at 12:04 AM SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
> > >  struct object_id *get_commit_tree_oid(const struct commit *);
> > >

> > >  /*
> > > diff --git a/contrib/coccinelle/commit.cocci b/contrib/coccinelle/commit.cocci
> > > index c49aa558f0..f5bc639981 100644
> > > --- a/contrib/coccinelle/commit.cocci
> > > +++ b/contrib/coccinelle/commit.cocci
> > > @@ -12,12 +12,12 @@ expression c;
> > >
> > >  // These excluded functions must access c->maybe_tree direcly.
> > >  @@
> > > -identifier f !~ "^(get_commit_tree|get_commit_tree_in_graph_one|load_tree_for_commit)$";
> > > +identifier f !~ "^(repo_get_commit_tree|get_commit_tree_in_graph_one|load_tree_for_commit)$";
> > >  expression c;
> > >  @@
> > >    f(...) {<...
> > >  - c->maybe_tree
> > > -+ get_commit_tree(c)
> > > ++ repo_get_commit_tree(the_repository, c)
> >
> > So, why this change?
>
> Because get_commit_tree() now becomes a compat wrapper (yes I'll fill
> in the commit message ;) and should be avoided.
>
> > It would also require furher changes to 'commit.cocci', in particular
> > to the last semantic patch, which is supposed to ensure that
> > get_commit_tree() doesn't end up on the LHS of an assignment, but with
> > this change Coccinelle does suggest transfomations with
> > repo_get_commit_tree() on the LHS.
>
> Oooh.. I see now. I actually updated that then dropped, thinking that
> a function call cannot be on LHS and that conversion is for
> already-long-gone code anyway. But yeah when you stack that conversion
> on top of this, it makes sense that we need double conversion to avoid
> build error.
>
> Since I will have to update this patch anyway, I'll update the commit
> message on the first cocci patch too.

This actually broke the build. So here is what I have on top of `pu` to
make it work again:

-- snip --
Subject: [PATCH] fixup??? commit.c: add repo_get_commit_tree()

The search/replace of this patch was apparently not done fully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 contrib/coccinelle/commit.cocci | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/coccinelle/commit.cocci b/contrib/coccinelle/commit.cocci
index f5bc639981..7f53f361c7 100644
--- a/contrib/coccinelle/commit.cocci
+++ b/contrib/coccinelle/commit.cocci
@@ -24,5 +24,5 @@ expression c;
 expression c;
 expression s;
 @@
-- get_commit_tree(c) = s
+- repo_get_commit_tree(the_repository, c) = s
 + c->maybe_tree = s
-- snap --

Ciao,
Johannes

>
> >
> > >    ...>}
> > >
> > >  @@
> > > --
> > > 2.21.0.479.g47ac719cd3
> > >
>
>
>
> --
> Duy
>

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux