Re: [PATCH 2/8] entry: factor out unlink_entry function
From: Elijah Newren <hidden>
Date: 2018-12-10 17:23:52
On Mon, Dec 10, 2018 at 7:50 AM Duy Nguyen [off-list ref] wrote:
On Sun, Dec 9, 2018 at 9:05 PM Thomas Gummerer [off-list ref] wrote:quoted
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.
I also started using unlink_entry() in another place in a local patch series that I haven't submitted yet (and which I need to get back to at some point). So this will help me too. :-)
quoted
Signed-off-by: Thomas Gummerer <redacted> --- 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.
"move the 'removal' variable in symlinks"? I'm having a really hard time parsing that phrase and the sentence it's embedded in. Could you reword for me Duy?