fix(transport): get oid_type on local transport

Cache `oid_type` in `transport_local` struct during `connect()`
so `git_remote_oid_type()` keeps working after disconnect.

This matches the smart transport behavior.
This commit is contained in:
Weihang Lo
2026-04-23 23:05:09 -04:00
parent 6753d535c8
commit e047e80074
2 changed files with 11 additions and 8 deletions

View File

@@ -481,13 +481,9 @@ void test_network_remote_local__sha256_oid_type(void)
git_remote_disconnect(remote);
/*
* Uncomment to reproduce SIGSEGV: local_oid_type dereferences
* t->repo->oid_type, but local_close already freed t->repo.
*
* cl_git_pass(git_remote_oid_type(&oid_type, remote));
* cl_assert_equal_i(GIT_OID_SHA256, oid_type);
*/
/* oid_type remains available after disconnect */
cl_git_pass(git_remote_oid_type(&oid_type, remote));
cl_assert_equal_i(GIT_OID_SHA256, oid_type);
#endif
}