← Winnitude! Search  ·  Reader Mode (817 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 23 LINKS

fix(remote): keep the note on fetch results by JROtto5 · Pull Request #2351 · gitpython-developers/GitPython

Repository navigation

fix(remote): keep the note on fetch results - #2351


Merged
Byron merged 2 commits into gitpython-developers:main from JROtto5:fix/fetch-info-note Nov 22, 2026
Merged

fix(remote): keep the note on fetch results #2351 Byron merged 2 commits into gitpython-developers:main from JROtto5:fix/fetch-info-note

Conversation

JROtto5 commented Nov 22, 2026



Copy link Copy Markdown
Contributor

I am a Claude (Opus 5.5) agent working through the contributor's account.

While comparing GitPython's parsers of Git's porcelain and status output with what a current Git (2.56) prints, I started with Remote.fetch(), because its result decoding was rewritten when storage moved to Git and Gix. A forced fetch returned an empty FetchInfo.note.

Git appends the note after two spaces (" (%s)" in builtin/fetch.c , e.g. feat -> origin/feat (forced update), v1 -> v1 (would clobber existing tag)), but _re_fetch_result expects four. The note group is optional and the pattern isn't anchored, so the line still matches and the note is dropped without a warning. The four spaces predate the 3.2 rewrite, so the field has been empty for a long time. The existing test only checked assertIsNotNone.

Accept the two spaces Git writes. The value keeps its parentheses, which is what the original group captured. Code that relied on note always being empty will now get text, so one line in the Unreleased API changes records the now populated field.

Validation on Linux, CPython 3.14.4, Git 2.56.0:

  • The two changed tests fail on the original remote.py and pass with the change, under both GIT_PYTHON_BACKEND=cli and =gix.
  • Complete test/test_remote.py (including the net-marked test_base): 41 passed with each backend.
  • Ruff check and format pass on the changed files.

Not run: the rest of the suite, mypy, other platforms and Python versions. The pruned-branch line ([deleted] (none) -> origin/x) still logs a "Cannot decode fetch result" warning. That is a separate issue and is left alone here.

JROtto5 and others added 2 commits November 22, 2026 02:01 fix(remote): keep the note on fetch results 7386a15
`FetchInfo.note` was always empty. Git appends the note to a fetch status line
after two spaces, e.g. `-> origin/main  (forced update)` or
`-> v1  (would clobber existing tag)`, but `_re_fetch_result` only accepted it
after four. The group is optional and the pattern is not anchored at the end,
so the line still matched and the note was dropped silently.

Accept the two spaces Git writes. The value keeps its parentheses, which is
what the original pattern captured.

`test_base` now checks the forced-update note from a real fetch instead of only
`assertIsNotNone`, and `test_fetch_info` parses a rejected tag line. Both fail
without this change. The changelog notes the now populated field.

Agent-Model: claude-opus-5-5
review 7d9a2f0 Byron merged commit 27769ab into gitpython-developers : main Nov 22, 2026 64 checks passed This was referenced Nov 24, 2026 fix(submodule): resolve branch = . when update() clones a submodule #2362 Merged fix(submodule): read branch as a string when re-reading .gitmodules #2363 Merged Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

2 participants