From: Junio C Hamano Date: Fri, 06 Nov 2026 01:59:12 GMT Subject: Re: [PATCH v4 7/7] stash: simplify reset_tree() function signature Message-ID: In-Reply-To: Phillip Wood writes: > From: Phillip Wood > > There is only one caller and it does not want to update the worktree or > reset the index so remove those unused parameters. > > Signed-off-by: Phillip Wood > --- > builtin/stash.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) Ah, an obvious simplification. Very nice. > > diff --git a/builtin/stash.c b/builtin/stash.c > index f97cd4771a5..f0e3053ab49 100644 > --- a/builtin/stash.c > +++ b/builtin/stash.c > @@ -332,7 +332,7 @@ static int clear_stash(int argc, const char **argv, const char *prefix, > return do_clear_stash(); > } > > -static int reset_tree(struct object_id *i_tree, int update, int reset) > +static int reset_tree(struct object_id *i_tree) > { > int nr_trees = 1; > struct unpack_trees_options opts; > @@ -358,10 +358,6 @@ static int reset_tree(struct object_id *i_tree, int update, int reset) > opts.src_index = the_repository->index; > opts.dst_index = the_repository->index; > opts.merge = 1; > - opts.reset = reset ? UNPACK_RESET_PROTECT_UNTRACKED : 0; > - opts.update = update; > - if (update) > - opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */ > opts.fn = oneway_merge; > > if (unpack_trees(nr_trees, t, &opts)) > @@ -738,7 +734,7 @@ static enum stash_apply_result do_apply_stash(const char *prefix, > } > > if (has_index) { > - if (reset_tree(&index_tree, 0, 0)) > + if (reset_tree(&index_tree)) > ret = -1; > } else { > unstage_changes_unless_new(&c_tree);