diff options
author | Thomas Rast <trast@student.ethz.ch> | 2011-12-06 18:43:38 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-06 14:58:53 -0800 |
commit | 11c8a74a64a49f236d475514f723123a8928463d (patch) | |
tree | f50a32b95aef604f059cf60813f8ad5be881e32c /t/t0090-cache-tree.sh | |
parent | 996277c520641d650dc15ad751cc4ad33318e298 (diff) | |
download | git-11c8a74a64a49f236d475514f723123a8928463d.tar.gz |
commit: write cache-tree data when writing index anyway
In prepare_index(), we refresh the index, and then write it to disk if
this changed the index data. After running hooks we re-read the index
and compute the root tree sha1 with the cache-tree machinery.
This gives us a mostly free opportunity to write up-to-date cache-tree
data: we can compute it in prepare_index() immediately before writing
the index to disk.
If we do this, we were going to write the index anyway, and the later
cache-tree update has no further work to do. If we don't do it, we
don't do any extra work, though we still don't have have cache-tree
data after the commit.
The only case that suffers badly is when the pre-commit hook changes
many trees in the index. I'm writing this off as highly unusual.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0090-cache-tree.sh')
-rwxr-xr-x | t/t0090-cache-tree.sh | 2 |
1 files changed, 1 insertions, 1 deletions
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 ' |