From e15479a7dcd5da0db96a11f9f85a5d3ddf2e680b Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 3 Jan 2026 22:02:42 -0500 Subject: [PATCH] fix(smart): keep caps across RPC stream resets Preserve ref-advertised capabilities when only the stream is reset. This prevents losing `object-format` before `git_remote_oid_type()` and fixes SHA256 clone pack trailer mismatch. Fixes libgit2/libgit2#7182 --- src/libgit2/transports/smart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libgit2/transports/smart.c b/src/libgit2/transports/smart.c index 7bf964ac2..ebd5a5b86 100644 --- a/src/libgit2/transports/smart.c +++ b/src/libgit2/transports/smart.c @@ -64,14 +64,14 @@ GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransp if (t->wrapped->close(t->wrapped) < 0) return -1; + + git__free(t->caps.object_format); + t->caps.object_format = NULL; + + git__free(t->caps.agent); + t->caps.agent = NULL; } - git__free(t->caps.object_format); - t->caps.object_format = NULL; - - git__free(t->caps.agent); - t->caps.agent = NULL; - return 0; }