Skip to content

Commit 652bd02

Browse files
vdyettaylorr
authored andcommitted
rebase: use 'skip_cache_tree_update' option
Enable the 'skip_cache_tree_update' option in both 'do_reset()' ('sequencer.c') and 'reset_head()' ('reset.c'). Both of these callers invoke 'prime_cache_tree()' after 'unpack_trees()', so we can remove an unnecessary cache tree rebuild by skipping 'cache_tree_update()'. When testing with 'p3400-rebase.sh' and 'p3404-rebase-interactive.sh', the performance change of this update was negligible, likely due to the operation being dominated by more expensive operations (like checking out trees). However, since the change doesn't harm performance, it's worth keeping this 'unpack_trees()' usage consistent with others that subsequently invoke 'prime_cache_tree()'. Signed-off-by: Victoria Dye <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent dc5d40f commit 652bd02

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

reset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
128128
unpack_tree_opts.update = 1;
129129
unpack_tree_opts.merge = 1;
130130
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
131+
unpack_tree_opts.skip_cache_tree_update = 1;
131132
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
132133
if (reset_hard)
133134
unpack_tree_opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;

sequencer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,6 +3748,7 @@ static int do_reset(struct repository *r,
37483748
unpack_tree_opts.merge = 1;
37493749
unpack_tree_opts.update = 1;
37503750
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
3751+
unpack_tree_opts.skip_cache_tree_update = 1;
37513752
init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
37523753

37533754
if (repo_read_index_unmerged(r)) {

0 commit comments

Comments
 (0)