@@ -429,3 +429,38 @@ void test_network_remote_local__opportunistic_update(void)
429
429
cl_git_pass (git_reference_lookup (& ref , repo , "refs/remotes/origin/master" ));
430
430
git_reference_free (ref );
431
431
}
432
+
433
+ void test_network_remote_local__update_tips_for_new_remote (void ) {
434
+ git_repository * src_repo ;
435
+ git_repository * dst_repo ;
436
+ git_remote * new_remote ;
437
+ git_push * push ;
438
+ git_reference * branch ;
439
+
440
+ /* Copy test repo */
441
+ cl_fixture_sandbox ("testrepo.git" );
442
+ cl_git_pass (git_repository_open (& src_repo , "testrepo.git" ));
443
+
444
+ /* Set up an empty bare repo to push into */
445
+ cl_git_pass (git_repository_init (& dst_repo , "./localbare.git" , 1 ));
446
+
447
+ /* Push to bare repo */
448
+ cl_git_pass (git_remote_create (& new_remote , src_repo , "bare" , "./localbare.git" ));
449
+ cl_git_pass (git_remote_connect (new_remote , GIT_DIRECTION_PUSH ));
450
+ cl_git_pass (git_push_new (& push , new_remote ));
451
+ cl_git_pass (git_push_add_refspec (push , "refs/heads/master" ));
452
+ cl_git_pass (git_push_finish (push ));
453
+ cl_assert (git_push_unpack_ok (push ));
454
+
455
+ /* Update tips and make sure remote branch has been created */
456
+ cl_git_pass (git_push_update_tips (push , NULL , NULL ));
457
+ cl_git_pass (git_branch_lookup (& branch , src_repo , "bare/master" , GIT_BRANCH_REMOTE ));
458
+
459
+ git_reference_free (branch );
460
+ git_push_free (push );
461
+ git_remote_free (new_remote );
462
+ git_repository_free (dst_repo );
463
+ cl_fixture_cleanup ("localbare.git" );
464
+ git_repository_free (src_repo );
465
+ cl_fixture_cleanup ("testrepo.git" );
466
+ }
0 commit comments