diff --git a/src/Commands/Clone.cs b/src/Commands/Clone.cs index 683b8846..f2faed14 100644 --- a/src/Commands/Clone.cs +++ b/src/Commands/Clone.cs @@ -12,7 +12,7 @@ namespace SourceGit.Commands WorkingDirectory = path; TraitErrorAsOutput = true; SSHKey = sshKey; - Args = "clone --progress --verbose --recurse-submodules "; + Args = "clone --progress --verbose "; if (!string.IsNullOrEmpty(extraArgs)) Args += $"{extraArgs} "; diff --git a/src/Commands/QuerySubmodules.cs b/src/Commands/QuerySubmodules.cs index 5fd6e3d5..6ebfa8b1 100644 --- a/src/Commands/QuerySubmodules.cs +++ b/src/Commands/QuerySubmodules.cs @@ -24,8 +24,6 @@ namespace SourceGit.Commands { var submodules = new List(); var rs = ReadToEnd(); - if (!rs.IsSuccess) - return submodules; var builder = new StringBuilder(); var lines = rs.StdOut.Split('\n', System.StringSplitOptions.RemoveEmptyEntries); diff --git a/src/ViewModels/Clone.cs b/src/ViewModels/Clone.cs index 98d3bf41..924cbc26 100644 --- a/src/ViewModels/Clone.cs +++ b/src/ViewModels/Clone.cs @@ -127,6 +127,14 @@ namespace SourceGit.ViewModels config.Set("remote.origin.sshkey", _sshKey); } + // individually update submodule (if any) + var submoduleList = new Commands.QuerySubmodules(path).Result(); + foreach (var submodule in submoduleList) + { + var update = new Commands.Submodule(path); + update.Update(submodule.Path, true, true, false, SetProgressDescription); + } + CallUIThread(() => { var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(path, null, true); diff --git a/src/ViewModels/UpdateSubmodules.cs b/src/ViewModels/UpdateSubmodules.cs index d1c433e2..3553d1b5 100644 --- a/src/ViewModels/UpdateSubmodules.cs +++ b/src/ViewModels/UpdateSubmodules.cs @@ -56,25 +56,24 @@ namespace SourceGit.ViewModels { _repo.SetWatcherEnabled(false); - string target = string.Empty; + List targets; if (_updateAll) - { - ProgressDescription = "Updating submodules ..."; - } + targets = Submodules; else - { - target = SelectedSubmodule; - ProgressDescription = $"Updating submodule {target} ..."; - } + targets = [SelectedSubmodule]; return Task.Run(() => { - new Commands.Submodule(_repo.FullPath).Update( - target, - EnableInit, - EnableRecursive, - EnableRemote, - SetProgressDescription); + foreach (var submodule in targets) + { + ProgressDescription = $"Updating submodule {submodule} ..."; + new Commands.Submodule(_repo.FullPath).Update( + submodule, + EnableInit, + EnableRecursive, + EnableRemote, + SetProgressDescription); + } CallUIThread(() => _repo.SetWatcherEnabled(true)); return true;