Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2022-11-10 22:06:03 +0300
committerTaylor Blau <me@ttaylorr.com>2022-11-11 05:49:34 +0300
commit0e47bca0f7592f8053ffcc530d8afa1d2e364563 (patch)
tree3b9f052368b9ec903211b02b0fb08fca58957497 /builtin/reset.c
parent68fcd48bafa1ef51b1ba40a41cb0fcdbad7acce1 (diff)
reset: use 'skip_cache_tree_update' option
Enable the 'skip_cache_tree_update' option in the variants that call 'prime_cache_tree()' after 'unpack_trees()' (specifically, 'git reset --mixed' and 'git reset --hard'). This avoids redundantly rebuilding the cache tree in both 'cache_tree_update()' at the end of 'unpack_trees()' and in 'prime_cache_tree()', resulting in a small (but consistent) performance improvement. From the newly-added 'p7102-reset.sh' test: Test before after -------------------------------------------------------------------- 7102.1: reset --hard (...) 2.11(0.40+1.54) 1.97(0.38+1.47) -6.6% Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/reset.c')
-rw-r--r--builtin/reset.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index fdce6f8c85..ab02777482 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -73,9 +73,11 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t
case HARD:
opts.update = 1;
opts.reset = UNPACK_RESET_OVERWRITE_UNTRACKED;
+ opts.skip_cache_tree_update = 1;
break;
case MIXED:
opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
+ opts.skip_cache_tree_update = 1;
/* but opts.update=0, so working tree not updated */
break;
default: