Skip to content

fix(remote): skip pruned refs without a decode warning - #2357

Merged
Byron merged 2 commits into
gitpython-developers:mainfrom
JROtto5:fix/fetch-prune-line
Nov 24, 2026
Merged

Byron merged 2 commits into
gitpython-developers:mainfrom
JROtto5:fix/fetch-prune-line

Conversation

@JROtto5

@JROtto5 JROtto5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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

Still comparing GitPython's fetch parsing with what Git prints. remote.fetch(prune=True) logs a "Cannot decode fetch result" warning for every ref it prunes:

Cannot decode fetch result ' - [deleted]  (none)  -> origin/topic': Cannot unambiguously resolve fetched reference 'origin/topic'

_get_fetch_info_from_stderr passes the - [deleted] line to FetchInfo._from_line, which tries to resolve a ref that the prune just removed. The existing prune check in test_base already expects these lines to be skipped; they were only skipped through the exception. Skip them before decoding instead; nothing is returned for them, as before.

Validation on Linux, Git 2.56.0:

  • test_fetch_prune_skips_deleted_refs (offline, fetches from the repository itself) fails without the change and passes with it under both GIT_PYTHON_BACKEND=cli and gix; test/test_remote.py passes (42) under both.
  • Ruff check and format pass.

Not run: the complete suite, mypy, other platforms.

JROtto5 and others added 2 commits November 23, 2026 01:05
`git fetch --prune` reports each remote-tracking ref it deletes as

     - [deleted]         (none)     -> origin/gone

`_get_fetch_info_from_stderr()` collects these with the other fetch
lines, `FetchInfo._from_line()` can't resolve a ref that no longer
exists, and every pruned ref logs "Cannot decode fetch result" at
WARNING. The result list was already right; only the warning was
spurious. Skip the deleted lines before decoding, as the test already
expects ("These should just be skipped").

`test_fetch_prune_skips_deleted_refs` prunes a branch fetched from the
repository itself and checks that no decode warning is logged; it
needs no network and fails without this change under both the `cli`
and `gix` backends.

Agent-Model: claude-opus-5-5
@Byron
Byron merged commit 60a2715 into gitpython-developers:main Nov 24, 2026
59 of 64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants