Repository navigation
Commit 16084b6
committed
fix(gix): use Git for signed and line-feed-only tag messages
On the Gix backend, `TagObject._set_cache_()` builds `TagObject.message`
by joining the `message` and `signature` that `_backend.object_metadata()`
returns from GixPython's `Tag.decode()`. GixPython 0.3.0 omits the line
feed that separates a message from a trailing `PGP SIGNATURE`,
`PGP MESSAGE`, `SIGNED MESSAGE` or `SSH SIGNATURE` armor block, so every
signed tag lost it. For a tag made with `git tag -s -m 'Release 1.0'`
and SSH signing, `git cat-file tag` and the CLI backend have
`Release 1.0\n-----BEGIN SSH SIGNATURE-----...`, while the Gix backend
reported `Release 1.0-----BEGIN SSH SIGNATURE-----...`. The last message
line runs into the armor header, so code that separates the signature
at its armor line no longer finds it.
The two fields cannot be joined back in Python: a body that starts with
the armor and one that starts with an empty line before it decode to
the same `message` and `signature`. Gix also adds a line feed to a body
of only line feeds, so the body `\n\n` gave a `TagObject.message` of
`\n\n` instead of `\n`.
The adapter now selects the CLI path when Gix splits off a signature or
reports a message of two or more line feeds and nothing else. The guard
only chooses the fallback and produces no values. Unsigned tags and
empty messages stay native: an empty body decodes as one line feed,
which the existing final line-feed trim already removes. The mismatch is
recorded as GIX-46 in `doc/gix-backend.md` (GIX-36 is used by the
pending tree-mode change); this guard does not close it.
Validation on macOS arm64 with CPython 3.13.17, Git 2.54.0 and
GixPython 0.3.0:
- `test_tag_message_matches_git`, using the new `tag-message` case in
`tests/fixtures/refs.sh`, fails for all four variants with SHA-1 and
SHA-256 on the Gix backend before the change and passes on both
backends after it.
- An SSH-signed tag from `git tag -s` and armor-shaped probes
(`PGP MESSAGE`, `SIGNED MESSAGE`, a `CERTIFICATE` block, armor text
inside a line, empty and unsigned bodies) give identical
`TagObject.message` values on both backends. The certificate, inline,
empty and unsigned cases stay native.
- `test_tag_without_tagger_initializes_all_metadata`, which forbids CLI
calls for unsigned and empty tag messages, still passes on Gix.
- Full suite with `-m "not net"`: 2093 passed, 154 skipped, 1 xfailed on
the CLI backend; 2196 passed, 51 skipped, 1 xfailed on the Gix backend,
where native tag decoding still serves 34 calls and the new fallback
serves only the 8 calls from the new test.
- Ruff check and format, mypy, shellcheck and `git diff --check` pass.1 parent 9232dc5 commit 16084b6
4 files changed
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
1019 | 1021 | | |
1020 | 1022 | | |
1021 | 1023 | | |
| 1024 | + | |
1022 | 1025 | | |
1023 | 1026 | | |
1024 | 1027 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
197 | 222 | | |
198 | 223 | | |
199 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| |||
0 commit comments