Repository navigation
Commit 88958c9
fix(tree): address partial cache review feedback
Review item #2274 (comment)
reports that "subsequent iteration or lookup silently accepts that truncated
tree" after an entry fails validation. Stored trees containing a `.git`
entry reproduce this on both backends: the first iteration rejects the name,
but the second accepts an empty tree or the valid prefix.
Build the entries in a local list and attach `_cache` only after every record
passes parsing and validation. Failed reads leave the lazy cache unset, so
later accesses retry and raise the same error instead of exposing partial data.
No backend behavior or tree validation policy changes. Git 2.54.0's `mktree`
and `ls-tree` accept and emit the fixture's `.git` entry; GitPython applies
its existing metadata-path guard while consuming that output.
Four regressions cover invalid entries first and last in SHA-1/SHA-256 trees.
All fail before the fix and pass afterwards on CLI and native Gix `ls_tree`.
All 97 tree tests pass on each backend. Ruff, ShellCheck and mypy pass.1 parent 7c77a2f commit 88958c9
3 files changed
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments