Re: [PATCH 2/8] entry: factor out unlink_entry function
- From
Thomas Gummerer <t.gummerer@gmail.com>
- Date
- Dec 20, 2018, 13:36 UTC
- Message-ID
- <20181220133643.GA25639@hank.intra.tgummerer.com>
- In-Reply-To
- <CACsJy8AGerhjnT0O6vT264tND78N5cbgFREzYtdmriXERu0Jtw@mail.gmail.com>
On 12/10, Duy Nguyen wrote:
Show 33 quoted lines
> On Sun, Dec 9, 2018 at 9:05 PM Thomas Gummerer <t.gummerer@gmail.com> wrote:
> >
> > Factor out the 'unlink_entry()' function from unpack-trees.c to
> > entry.c. It will be used in other places as well in subsequent
> > steps.
> >
> > As it's no longer a static function, also move the documentation to
> > the header file to make it more discoverable.
> >
> > Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> > ---
> > cache.h | 5 +++++
> > entry.c | 15 +++++++++++++++
> > unpack-trees.c | 19 -------------------
> > 3 files changed, 20 insertions(+), 19 deletions(-)
> >
> > diff --git a/cache.h b/cache.h
> > index ca36b44ee0..c1c953e810 100644
> > --- a/cache.h
> > +++ b/cache.h
> > @@ -1542,6 +1542,11 @@ struct checkout {
> > extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
> > extern void enable_delayed_checkout(struct checkout *state);
> > extern int finish_delayed_checkout(struct checkout *state);
> > +/*
> > + * Unlink the last component and schedule the leading directories for
> > + * removal, such that empty directories get removed.
> > + */
> > +extern void unlink_entry(const struct cache_entry *ce);
>
> I'm torn. We try to remove 'extern' but I can see you may want to add
> it here to be consistent with others. And removing extern even from
> functions from entry.c only would cause some conflicts.Yeah I felt like favoring consistency here would be better. Once your path counting series and my series land, this may get quieter and we can remove the 'extern' then?
> I wonder if we should move the 'removal' variable in symlinks to > 'struct checkout' to reduce another global variable. But I guess > that's the problem for another day. It's not the focus of this > series.
Yeah, I'd prefer leaving that for another day :)
> -- > Duy