mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 13:20:30 +08:00
refactor: --recursive will always be enabled while initializing or updating submodules
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -43,15 +43,13 @@ namespace SourceGit.Commands
|
||||
return await ExecAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateAsync(List<string> modules, bool init, bool recursive, bool useRemote = false)
|
||||
public async Task<bool> UpdateAsync(List<string> modules, bool init = false, bool useRemote = false)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
builder.Append("submodule update");
|
||||
builder.Append("submodule update --recursive");
|
||||
|
||||
if (init)
|
||||
builder.Append(" --init");
|
||||
if (recursive)
|
||||
builder.Append(" --recursive");
|
||||
if (useRemote)
|
||||
builder.Append(" --remote");
|
||||
if (modules.Count > 0)
|
||||
|
||||
@@ -872,7 +872,6 @@
|
||||
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Update Submodules</x:String>
|
||||
<x:String x:Key="Text.UpdateSubmodules.All" xml:space="preserve">All submodules</x:String>
|
||||
<x:String x:Key="Text.UpdateSubmodules.Init" xml:space="preserve">Initialize as needed</x:String>
|
||||
<x:String x:Key="Text.UpdateSubmodules.Recursive" xml:space="preserve">Traverse submodules recursively</x:String>
|
||||
<x:String x:Key="Text.UpdateSubmodules.Target" xml:space="preserve">Submodule:</x:String>
|
||||
<x:String x:Key="Text.UpdateSubmodules.UpdateToRemoteTrackingBranch" xml:space="preserve">Update to submodule's remote tracking branch</x:String>
|
||||
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
.UpdateAsync(submodules);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
.UpdateAsync(submodules);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
.UpdateAsync(submodules);
|
||||
|
||||
if (needPop)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(path)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, true, true);
|
||||
.UpdateAsync(submodules, true);
|
||||
}
|
||||
|
||||
log.Complete();
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
.UpdateAsync(submodules);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace SourceGit.ViewModels
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
.UpdateAsync(submodules);
|
||||
}
|
||||
|
||||
log.Complete();
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, false, true);
|
||||
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath).Use(log).PopAsync("stash@{0}");
|
||||
|
||||
@@ -39,12 +39,6 @@ namespace SourceGit.ViewModels
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public bool EnableRecursive
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public bool EnableRemote
|
||||
{
|
||||
get;
|
||||
@@ -93,7 +87,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(targets, EnableInit, EnableRecursive, EnableRemote);
|
||||
.UpdateAsync(targets, EnableInit, EnableRemote);
|
||||
|
||||
log.Complete();
|
||||
_repo.MarkSubmodulesDirtyManually();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
Text="{DynamicResource Text.UpdateSubmodules}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,Auto,32,32" ColumnDefinitions="120,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,Auto,32" ColumnDefinitions="120,*">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
@@ -59,11 +59,6 @@
|
||||
ToolTip.Tip="--init"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Content="{DynamicResource Text.UpdateSubmodules.Recursive}"
|
||||
IsChecked="{Binding EnableRecursive, Mode=TwoWay}"
|
||||
ToolTip.Tip="--recursive"/>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Content="{DynamicResource Text.UpdateSubmodules.UpdateToRemoteTrackingBranch}"
|
||||
IsChecked="{Binding EnableRemote, Mode=TwoWay}"
|
||||
ToolTip.Tip="--remote"/>
|
||||
|
||||
Reference in New Issue
Block a user