File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,8 +238,8 @@ int cache_tree_fully_valid(struct cache_tree *it)
238238 if (!it )
239239 return 0 ;
240240 if (it -> entry_count < 0 ||
241- odb_has_object (the_repository -> objects , & it -> oid ,
242- ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR ))
241+ ! odb_has_object (the_repository -> objects , & it -> oid ,
242+ ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR ))
243243 return 0 ;
244244 for (i = 0 ; i < it -> subtree_nr ; i ++ ) {
245245 if (!cache_tree_fully_valid (it -> down [i ]-> cache_tree ))
Original file line number Diff line number Diff line change @@ -278,4 +278,12 @@ test_expect_success 'switching trees does not invalidate shared index' '
278278 )
279279'
280280
281+ test_expect_success ' cache-tree is used by write-tree when valid' '
282+ test_commit use-valid &&
283+
284+ # write-tree with a valid cache-tree should skip cache_tree_update
285+ GIT_TRACE2_PERF="$(pwd)/trace.output" git write-tree &&
286+ test_grep ! region_enter.*cache_tree.*update trace.output
287+ '
288+
281289test_done
You can’t perform that action at this time.
0 commit comments