diff options
-rw-r--r-- | builtin/commit.c | 2 | ||||
-rwxr-xr-x | t/t0090-cache-tree.sh | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 4f782a33f1..5125841f92 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -394,6 +394,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, fd = hold_locked_index(&index_lock, 1); add_files_to_cache(also ? prefix : NULL, pathspec, 0); refresh_cache_or_die(refresh_flags); + update_main_cache_tree(1); if (write_cache(fd, active_cache, active_nr) || close_lock_file(&index_lock)) die(_("unable to write new_index file")); @@ -414,6 +415,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, fd = hold_locked_index(&index_lock, 1); refresh_cache_or_die(refresh_flags); if (active_cache_changed) { + update_main_cache_tree(1); if (write_cache(fd, active_cache, active_nr) || commit_locked_index(&index_lock)) die(_("unable to write new_index file")); diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 3d0702a6f9..a3527a5c99 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -70,7 +70,7 @@ test_expect_success 'test-scrap-cache-tree works' ' test_no_cache_tree ' -test_expect_failure 'second commit has cache-tree' ' +test_expect_success 'second commit has cache-tree' ' test_commit bar && test_shallow_cache_tree ' |