summaryrefslogtreecommitdiff
path: root/gitweb/static/gitweb.css
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2026-06-14 06:37:26 +0000
committerJunio C Hamano <gitster@pobox.com>2026-06-14 07:50:47 -0700
commit0c8eb46fbbfc48065bc93dcc4c9901031615516c (patch)
treea1df1bf5b641a04895f03936fb7fa2cf7f38b9d4 /gitweb/static/gitweb.css
parent43a5fa7f5a9b7c44dd958a21368d690fa55d4f50 (diff)
cache-tree: fix verify_cache() to catch non-adjacent D/F conflicts
verify_cache() checks that the index does not contain both "path" and "path/file" before writing a tree. It does this by comparing only adjacent entries, relying on the assumption that "path/file" would immediately follow "path" in sorted order. Unfortunately, this assumption does not always hold. For example: docs <-- submodule entry docs-internal/README.md <-- intervening entry docs/requirements.txt <-- D/F conflict, NOT adjacent to "docs" When this happens, verify_cache() silently misses the D/F conflict and write-tree produces a corrupt tree object containing duplicate entries (one for the submodule "docs" and one for the tree "docs"). I could not find any caller in current git that both allows the index to get into this state and then tries to write it out without doing other checks beyond the verify_cache() call in cache_tree_update(), but verify_cache() is documented as a safety net for preventing corrupt trees and should actually provide that guarantee. A downstream consumer that relied solely on cache_tree_update()'s internal checking via verify_cache() to prevent duplicate tree entries was bitten by the gap. Add a test that constructs a corrupt index directly (bypassing the D/F checks in add_index_entry) and verifies that write-tree now rejects it. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/static/gitweb.css')
0 files changed, 0 insertions, 0 deletions