Re: [PATCH 2/8] entry: factor out unlink_entry function
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Dec 10, 2018, 15:49 UTC
- Message-ID
- <CACsJy8AGerhjnT0O6vT264tND78N5cbgFREzYtdmriXERu0Jtw@mail.gmail.com>
- In-Reply-To
- <20181209200449.16342-3-t.gummerer@gmail.com>
On Sun, Dec 9, 2018 at 9:05 PM Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 28 quoted lines
>
> 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.
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.
-- Duy