Commit 5bfc2f5
fix!: Allow round-tripping for Trees
Change the internal representation of `EntryMode` to fix a round-trip
issue.
Prior to this change, both `b"040000"` and `b"40000"` mapped to
`0o40000u16`.
After this change,
* `b"040000"` is represented by `0o140000`
* `b"40000"` is represented by `0o40000`
*Tests*:
We can see in the `as_bytes` test that the behaviour is fixed now.
We also add a test to show we now can round-trip on the existing test
fixtures which contain examples of this situation.
*Performance*:
We pay a cost for this compared to the parent commit:
```
TreeRefIter() time: [50.403 ns 50.611 ns 50.830 ns]
change: [+8.6240% +9.0871% +9.5776%] (p = 0.00 < 0.05)
Performance has regressed.
```
but we already did enough optimizations to pay for this earlier in this
PR:
* `main`: `~55 ns`
* `parent`: `~46 ns`
* `this commit`: `~50 ns`
Fixes 18871 parent 8969245 commit 5bfc2f5
File tree
3 files changed
+23
-4
lines changed- gix-object
- src/tree
- tests/object/tree
3 files changed
+23
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| 88 | + | |
82 | 89 | | |
83 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| |||
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
121 | 137 | | |
122 | 138 | | |
123 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | 73 | | |
75 | 74 | | |
76 | | - | |
| 75 | + | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
0 commit comments