On Sat, Jun 28, 2014 at 7:20 AM, David Turner <dturner@xxxxxxxxxxxxxxxx> wrote: > When git checkout checks out a branch, create or update the > cache-tree so that subsequent operations are faster. > > Signed-off-by: David Turner <dturner@xxxxxxxxxxx> > --- > builtin/checkout.c | 4 ++++ > cache-tree.c | 22 ++++++++++++---------- > cache-tree.h | 1 + > t/t0090-cache-tree.sh | 15 ++++++++++++++- > 4 files changed, 31 insertions(+), 11 deletions(-) > > diff --git a/builtin/checkout.c b/builtin/checkout.c > index 07cf555..df791e8 100644 > --- a/builtin/checkout.c > +++ b/builtin/checkout.c > @@ -553,6 +553,10 @@ static int merge_working_tree(const struct checkout_opts *opts, > } > } > > + if (write_cache_as_tree(NULL, WRITE_TREE_DO_NOT_WRITE, "")) { > + warn("Unable to write cache_tree"); > + } > + I wonder if we should do this in !opts->force code path only. In the opts->force code path we could use prime_cache_tree() (like read-tree), which is supposedly faster (but may need some tests to be sure). prime_cache_tree() could be made a bit faster by doing it during tree traversal in unpack_trees() so we don't have to unpack any tree objects twice. -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html