Repository navigation
Commit 15100e1
fix(submodule): read
`Submodule.iter_items()` reads `submodule.<name>.branch` as a string and
turns it into a full ref, so `branch = 1.10` gives `refs/heads/1.10`.
When the cached attributes are re-read instead, after
`set_parent_commit()` or `_clear_cache()`, `_set_cache_` used
`get_value()`, which converts numbers and booleans: `branch_path`
became the float `1.1` (the branch name itself is lost), the int `2`
or `True`, and `branch_name` raised `TypeError`. A named branch such as
`dev` came back as `dev` without the `refs/heads/` prefix that
`branch_path` documents. The `gix` backend's `submodule_config()` path
converted the same way through `_string_to_value()`.
Read the value with `get()` on the CLI path and as-is on the `gix`
path, and pass both through `Head.to_full_path()`, as `iter_items()`
does. Values that already are full refs are unchanged. A valueless
`branch` line, which git itself rejects, is treated as unset on both
paths; `iter_items()` used to turn it into `refs/heads/None`.
`test_reread_branch_matches_iter_items` sets the branch to `1.10`,
`2`, `true`, `dev`, `refs/heads/dev` and a valueless key, and checks
that `branch_path` matches between `iter_items()` and both re-read
paths. Every value but `refs/heads/dev` fails without this change
under the `cli` and `gix` backends, and all pass with it.
Agent-Model: claude-opus-5-5branch as a string when re-reading .gitmodules
1 parent 0816ef5 commit 15100e1
2 files changed
Lines changed: 32 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 182 | + | |
187 | 183 | | |
188 | 184 | | |
189 | 185 | | |
| |||
197 | 193 | | |
198 | 194 | | |
199 | 195 | | |
200 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
201 | 199 | | |
202 | 200 | | |
203 | 201 | | |
| |||
1976 | 1974 | | |
1977 | 1975 | | |
1978 | 1976 | | |
1979 | | - | |
1980 | | - | |
1981 | | - | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1982 | 1980 | | |
1983 | 1981 | | |
1984 | 1982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2225 | 2225 | | |
2226 | 2226 | | |
2227 | 2227 | | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
2228 | 2253 | | |
2229 | 2254 | | |
2230 | 2255 | | |
| |||
0 commit comments