@@ -164,6 +164,39 @@ void test_online_clone__clone_into(void)
164164 git_buf_free (& path );
165165}
166166
167+ void test_online_clone__clone_mirror (void )
168+ {
169+ git_buf path = GIT_BUF_INIT ;
170+ git_remote * remote ;
171+ git_reference * head ;
172+ git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT ;
173+
174+ bool fetch_progress_cb_was_called = false;
175+
176+ cl_git_pass (git_repository_init (& g_repo , "./foo.git" , true));
177+ cl_git_pass (git_remote_create (& remote , g_repo , "origin" , LIVE_REPO_URL ));
178+
179+ callbacks .transfer_progress = & fetch_progress ;
180+ callbacks .payload = & fetch_progress_cb_was_called ;
181+ git_remote_set_callbacks (remote , & callbacks );
182+
183+ git_remote_clear_refspecs (remote );
184+ cl_git_pass (git_remote_add_fetch (remote , "+refs/*:refs/*" ));
185+
186+ cl_git_pass (git_clone_into (g_repo , remote , NULL , NULL , NULL ));
187+
188+ cl_git_pass (git_reference_lookup (& head , g_repo , "HEAD" ));
189+ cl_assert_equal_i (GIT_REF_SYMBOLIC , git_reference_type (head ));
190+ cl_assert_equal_s ("refs/heads/master" , git_reference_symbolic_target (head ));
191+
192+ cl_assert_equal_i (true, fetch_progress_cb_was_called );
193+
194+ git_remote_free (remote );
195+ git_reference_free (head );
196+ git_buf_free (& path );
197+ cl_fixture_cleanup ("./foo.git" );
198+ }
199+
167200static int update_tips (const char * refname , const git_oid * a , const git_oid * b , void * payload )
168201{
169202 int * callcount = (int * )payload ;
0 commit comments