mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
test(transport): get oid_type on local transport
Exercise git_remote_oid_type on a SHA256 local transport. The after-disconnect assertion is commented out because local_oid_type dereferences `t->repo`, which local_close has already freed (SIGSEGV). I ran these commands to test btw: ``` cmake .. -DGIT_EXPERIMENTAL_SHA256=ON -DBUILD_TESTS=ON cmake --build . ./libgit2_tests -snetwork::remote::local::sha256_oid_type ```
This commit is contained in:
@@ -467,6 +467,30 @@ void test_network_remote_local__push_delete(void)
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
void test_network_remote_local__sha256_oid_type(void)
|
||||
{
|
||||
#ifndef GIT_EXPERIMENTAL_SHA256
|
||||
cl_skip();
|
||||
#else
|
||||
git_oid_t oid_type;
|
||||
|
||||
connect_to_local_repository(cl_fixture("testrepo_256.git"));
|
||||
|
||||
cl_git_pass(git_remote_oid_type(&oid_type, remote));
|
||||
cl_assert_equal_i(GIT_OID_SHA256, oid_type);
|
||||
|
||||
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);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_network_remote_local__anonymous_remote_inmemory_repo(void)
|
||||
{
|
||||
git_repository *inmemory;
|
||||
|
||||
Reference in New Issue
Block a user