summaryrefslogtreecommitdiffstats
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorDavid Lin <davidzylin@gmail.com>2026-04-06 15:27:11 -0400
committerJunio C Hamano <gitster@pobox.com>2026-04-06 14:21:03 -0700
commit521731213c905f0dfec6a55393f010d185492c85 (patch)
treeae44d202bea7da3f0b1b912ba75267e1eda308a7 /Documentation/CodingGuidelines
parentbb5c624209fcaebd60b9572b2cc8c61086e39b57 (diff)
downloadgit-521731213c905f0dfec6a55393f010d185492c85.tar.gz
git-521731213c905f0dfec6a55393f010d185492c85.zip
cache-tree: fix inverted object existence check in cache_tree_fully_valid
The negation in front of the object existence check in cache_tree_fully_valid() was lost in 062b914c84 (treewide: convert users of `repo_has_object_file()` to `has_object()`, 2025-04-29), turning `!repo_has_object_file(...)` into `has_object(...)` instead of `!has_object(...)`. This makes cache_tree_fully_valid() always report the cache tree as invalid when objects exist (the common case), forcing callers like write_index_as_tree() to call cache_tree_update() on every invocation. An odb_has_object() check inside update_one() avoids a full tree rebuild, but the unnecessary call still pays the cost of opening an ODB transaction and, in partial clones, a promisor remote check. Restore the missing negation and add a test that verifies write-tree takes the cache-tree shortcut when the cache tree is valid. Helped-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: David Lin <davidlin@stripe.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/CodingGuidelines')
0 files changed, 0 insertions, 0 deletions