mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
* refactor: Update submodules individually to avoid failures (#925) - Remove `--recurse-submodules` flag from the clone command to simplify the cloning process. - Refactor submodule update logic to handle updating all submodules in a loop and improve progress description handling. * fix: Parse submodule list even if submodule status fails (#935)
This commit is contained in:
parent
a4157e11e6
commit
3af6012561
4 changed files with 22 additions and 17 deletions
|
@ -12,7 +12,7 @@ namespace SourceGit.Commands
|
||||||
WorkingDirectory = path;
|
WorkingDirectory = path;
|
||||||
TraitErrorAsOutput = true;
|
TraitErrorAsOutput = true;
|
||||||
SSHKey = sshKey;
|
SSHKey = sshKey;
|
||||||
Args = "clone --progress --verbose --recurse-submodules ";
|
Args = "clone --progress --verbose ";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(extraArgs))
|
if (!string.IsNullOrEmpty(extraArgs))
|
||||||
Args += $"{extraArgs} ";
|
Args += $"{extraArgs} ";
|
||||||
|
|
|
@ -24,8 +24,6 @@ namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
var submodules = new List<Models.Submodule>();
|
var submodules = new List<Models.Submodule>();
|
||||||
var rs = ReadToEnd();
|
var rs = ReadToEnd();
|
||||||
if (!rs.IsSuccess)
|
|
||||||
return submodules;
|
|
||||||
|
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
var lines = rs.StdOut.Split('\n', System.StringSplitOptions.RemoveEmptyEntries);
|
var lines = rs.StdOut.Split('\n', System.StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
|
@ -127,6 +127,14 @@ namespace SourceGit.ViewModels
|
||||||
config.Set("remote.origin.sshkey", _sshKey);
|
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(() =>
|
CallUIThread(() =>
|
||||||
{
|
{
|
||||||
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(path, null, true);
|
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(path, null, true);
|
||||||
|
|
|
@ -56,25 +56,24 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
|
||||||
string target = string.Empty;
|
List<string> targets;
|
||||||
if (_updateAll)
|
if (_updateAll)
|
||||||
{
|
targets = Submodules;
|
||||||
ProgressDescription = "Updating submodules ...";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
targets = [SelectedSubmodule];
|
||||||
target = SelectedSubmodule;
|
|
||||||
ProgressDescription = $"Updating submodule {target} ...";
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
new Commands.Submodule(_repo.FullPath).Update(
|
foreach (var submodule in targets)
|
||||||
target,
|
{
|
||||||
EnableInit,
|
ProgressDescription = $"Updating submodule {submodule} ...";
|
||||||
EnableRecursive,
|
new Commands.Submodule(_repo.FullPath).Update(
|
||||||
EnableRemote,
|
submodule,
|
||||||
SetProgressDescription);
|
EnableInit,
|
||||||
|
EnableRecursive,
|
||||||
|
EnableRemote,
|
||||||
|
SetProgressDescription);
|
||||||
|
}
|
||||||
|
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue