diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-09 13:40:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-09 13:40:32 -0700 |
commit | 6d5c16a90ccf5724fb885d4b8af295c640da33a4 (patch) | |
tree | df8b5876c2667924dbf78515091b2ec543ad597d /builtin/reset.c | |
parent | 00fb2d25632191b89ac4144e1a6498470a4a1c9e (diff) | |
parent | 4cd675565647b2ccacdd6c93841b4ff06c32b16a (diff) | |
download | git-6d5c16a90ccf5724fb885d4b8af295c640da33a4.tar.gz git-6d5c16a90ccf5724fb885d4b8af295c640da33a4.tar.xz |
Merge branch 'tr/cache-tree' into maint-1.7.8
* tr/cache-tree:
t0090: be prepared that 'wc -l' writes leading blanks
reset: update cache-tree data when appropriate
commit: write cache-tree data when writing index anyway
Refactor cache_tree_update idiom from commit
Test the current state of the cache-tree optimization
Add test-scrap-cache-tree
Diffstat (limited to 'builtin/reset.c')
-rw-r--r-- | builtin/reset.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/reset.c b/builtin/reset.c index 811e8e252..8c2c1d52a 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -43,6 +43,7 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet int nr = 1; int newfd; struct tree_desc desc[2]; + struct tree *tree; struct unpack_trees_options opts; struct lock_file *lock = xcalloc(1, sizeof(struct lock_file)); @@ -84,6 +85,12 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet return error(_("Failed to find tree of %s."), sha1_to_hex(sha1)); if (unpack_trees(nr, desc, &opts)) return -1; + + if (reset_type == MIXED || reset_type == HARD) { + tree = parse_tree_indirect(sha1); + prime_cache_tree(&active_cache_tree, tree); + } + if (write_cache(newfd, active_cache, active_nr) || commit_locked_index(lock)) return error(_("Could not write new index file.")); |