/// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
 public override ICollection <string> Call()
 {
     CheckCallable();
     try
     {
         SubmoduleWalk generator = SubmoduleWalk.ForIndex(repo);
         if (!paths.IsEmpty())
         {
             generator.SetFilter(PathFilterGroup.CreateFromStrings(paths));
         }
         StoredConfig   config      = repo.GetConfig();
         IList <string> initialized = new AList <string>();
         while (generator.Next())
         {
             // Ignore entry if URL is already present in config file
             if (generator.GetConfigUrl() != null)
             {
                 continue;
             }
             string path = generator.GetPath();
             // Copy 'url' and 'update' fields from .gitmodules to config
             // file
             string url    = generator.GetRemoteUrl();
             string update = generator.GetModulesUpdate();
             if (url != null)
             {
                 config.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.
                                  CONFIG_KEY_URL, url);
             }
             if (update != null)
             {
                 config.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.
                                  CONFIG_KEY_UPDATE, update);
             }
             if (url != null || update != null)
             {
                 initialized.AddItem(path);
             }
         }
         // Save repository config if any values were updated
         if (!initialized.IsEmpty())
         {
             config.Save();
         }
         return(initialized);
     }
     catch (IOException e)
     {
         throw new JGitInternalException(e.Message, e);
     }
     catch (ConfigInvalidException e)
     {
         throw new JGitInternalException(e.Message, e);
     }
 }