@@ -509,3 +509,44 @@ void test_network_fetchlocal__prune_load_fetch_prune_config(void)
509509 git_remote_free (origin );
510510 git_repository_free (repo );
511511}
512+
513+ static int update_tips_error (const char * ref , const git_oid * old , const git_oid * new , void * data )
514+ {
515+ int * callcount = (int * ) data ;
516+
517+ GIT_UNUSED (ref );
518+ GIT_UNUSED (old );
519+ GIT_UNUSED (new );
520+
521+ (* callcount )++ ;
522+
523+ return -1 ;
524+ }
525+
526+ void test_network_fetchlocal__update_tips_error_is_propagated (void )
527+ {
528+ git_repository * repo ;
529+ git_reference_iterator * iterator ;
530+ git_reference * ref ;
531+ git_remote * remote ;
532+ git_fetch_options options = GIT_FETCH_OPTIONS_INIT ;
533+ int callcount = 0 ;
534+
535+ cl_git_pass (git_repository_init (& repo , "foo.git" , true));
536+ cl_set_cleanup (cleanup_local_repo , "foo.git" );
537+
538+ cl_git_pass (git_remote_create_with_fetchspec (& remote , repo , "origin" , cl_git_fixture_url ("testrepo.git" ), "+refs/heads/*:refs/remotes/update-tips/*" ));
539+
540+ options .callbacks .update_tips = update_tips_error ;
541+ options .callbacks .payload = & callcount ;
542+
543+ cl_git_fail (git_remote_fetch (remote , NULL , & options , NULL ));
544+ cl_assert_equal_i (1 , callcount );
545+
546+ cl_git_pass (git_reference_iterator_glob_new (& iterator , repo , "refs/remotes/update-tips/**/" ));
547+ cl_assert_equal_i (GIT_ITEROVER , git_reference_next (& ref , iterator ));
548+
549+ git_reference_iterator_free (iterator );
550+ git_remote_free (remote );
551+ git_repository_free (repo );
552+ }
0 commit comments