@@ -373,6 +373,41 @@ def test_conditional_includes_from_branch_name_error(self, rw_dir):
373373            assert  not  config ._has_includes ()
374374            assert  config ._included_paths () ==  []
375375
376+     @with_rw_directory  
377+     def  test_conditional_includes_remote_url (self , rw_dir ):
378+         # Initiate mocked repository. 
379+         repo  =  mock .Mock ()
380+         repo .remotes  =  [mock .Mock (url = "https://github.com/foo/repo" )]
381+ 
382+         # Initiate config files. 
383+         path1  =  osp .join (rw_dir , "config1" )
384+         path2  =  osp .join (rw_dir , "config2" )
385+         template  =  '[includeIf "hasconfig:remote.*.url:{}"]\n     path={}\n ' 
386+ 
387+         # Ensure that config with hasconfig and full url is correct. 
388+         with  open (path1 , "w" ) as  stream :
389+             stream .write (template .format ("https://github.com/foo/repo" , path2 ))
390+ 
391+         with  GitConfigParser (path1 , repo = repo ) as  config :
392+             assert  config ._has_includes ()
393+             assert  config ._included_paths () ==  [("path" , path2 )]
394+ 
395+         # Ensure that config with hasconfig and incorrect url is incorrect. 
396+         with  open (path1 , "w" ) as  stream :
397+             stream .write (template .format ("incorrect" , path2 ))
398+ 
399+         with  GitConfigParser (path1 , repo = repo ) as  config :
400+             assert  not  config ._has_includes ()
401+             assert  config ._included_paths () ==  []
402+ 
403+         # Ensure that config with hasconfig and url using glob pattern is correct. 
404+         with  open (path1 , "w" ) as  stream :
405+             stream .write (template .format ("**/**github.com*/**" , path2 ))
406+ 
407+         with  GitConfigParser (path1 , repo = repo ) as  config :
408+             assert  config ._has_includes ()
409+             assert  config ._included_paths () ==  [("path" , path2 )]
410+ 
376411    def  test_rename (self ):
377412        file_obj  =  self ._to_memcache (fixture_path ("git_config" ))
378413        with  GitConfigParser (file_obj , read_only = False , merge_includes = False ) as  cw :
0 commit comments