From fa0bde45cdebee8bac95e66e4bf5ba16c77fbdba Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Fri, 27 Mar 2020 00:48:47 +0000 Subject: unpack-trees: simplify pattern_list freeing commit e091228e17 ("sparse-checkout: update working directory in-process", 2019-11-21) allowed passing a pre-defined set of patterns to unpack_trees(). However, if o->pl was NULL, it would still read the existing patterns and use those. If those patterns were read into a data structure that was allocated, naturally they needed to be free'd. However, despite the same function being responsible for knowing about both the allocation and the free'ing, the logic for tracking whether to free the pattern_list was hoisted to an outer function with an additional flag in unpack_trees_options. Put the logic back in the relevant function and discard the now unnecessary flag. Reviewed-by: Derrick Stolee Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- builtin/sparse-checkout.c | 1 - 1 file changed, 1 deletion(-) (limited to 'builtin') diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 740da4b6d5..d102a9697f 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -122,7 +122,6 @@ static int update_working_directory(struct pattern_list *pl) o.dst_index = r->index; o.skip_sparse_checkout = 0; o.pl = pl; - o.keep_pattern_list = !!pl; resolve_undo_clear_index(r->index); setup_work_tree(); -- cgit v1.2.3