enhance: add a checkbox to toggle Initialize & update submodules after clone

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-06 10:19:43 +08:00
parent 3af6012561
commit e784696058
No known key found for this signature in database
5 changed files with 22 additions and 5 deletions

View file

@ -97,6 +97,7 @@
<x:String x:Key="Text.Clone.LocalName" xml:space="preserve">Local Name:</x:String>
<x:String x:Key="Text.Clone.LocalName.Placeholder" xml:space="preserve">Repository name. Optional.</x:String>
<x:String x:Key="Text.Clone.ParentFolder" xml:space="preserve">Parent Folder:</x:String>
<x:String x:Key="Text.Clone.RecurseSubmodules" xml:space="preserve">Initialize &amp; update submodules</x:String>
<x:String x:Key="Text.Clone.RemoteURL" xml:space="preserve">Repository URL:</x:String>
<x:String x:Key="Text.Close" xml:space="preserve">CLOSE</x:String>
<x:String x:Key="Text.CodeEditor" xml:space="preserve">Editor</x:String>

View file

@ -100,6 +100,7 @@
<x:String x:Key="Text.Clone.LocalName" xml:space="preserve">本地仓库名 </x:String>
<x:String x:Key="Text.Clone.LocalName.Placeholder" xml:space="preserve">本地仓库目录的名字,选填。</x:String>
<x:String x:Key="Text.Clone.ParentFolder" xml:space="preserve">父级目录 </x:String>
<x:String x:Key="Text.Clone.RecurseSubmodules" xml:space="preserve">初始化并更新子模块</x:String>
<x:String x:Key="Text.Clone.RemoteURL" xml:space="preserve">远程仓库 </x:String>
<x:String x:Key="Text.Close" xml:space="preserve">关闭</x:String>
<x:String x:Key="Text.CodeEditor" xml:space="preserve">提交信息编辑器</x:String>

View file

@ -100,6 +100,7 @@
<x:String x:Key="Text.Clone.LocalName" xml:space="preserve">本機存放庫名稱:</x:String>
<x:String x:Key="Text.Clone.LocalName.Placeholder" xml:space="preserve">本機存放庫目錄的名稱,選填。</x:String>
<x:String x:Key="Text.Clone.ParentFolder" xml:space="preserve">父級目錄:</x:String>
<x:String x:Key="Text.Clone.RecurseSubmodules" xml:space="preserve">初始化並複製子模組</x:String>
<x:String x:Key="Text.Clone.RemoteURL" xml:space="preserve">遠端存放庫:</x:String>
<x:String x:Key="Text.Close" xml:space="preserve">關閉</x:String>
<x:String x:Key="Text.CodeEditor" xml:space="preserve">提交訊息編輯器</x:String>

View file

@ -53,6 +53,12 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _extraArgs, value);
}
public bool InitAndUpdateSubmodules
{
get;
set;
} = true;
public Clone(string pageId)
{
_pageId = pageId;
@ -128,12 +134,15 @@ namespace SourceGit.ViewModels
}
// individually update submodule (if any)
if (InitAndUpdateSubmodules)
{
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(() =>
{

View file

@ -10,7 +10,7 @@
<StackPanel Orientation="Vertical" Margin="8,0,0,0">
<TextBlock Classes="bold" FontSize="18" Text="{DynamicResource Text.Clone}"/>
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto,32,32,32" ColumnDefinitions="Auto,*">
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto,32,32,32,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right"
Margin="0,0,8,0"
@ -75,6 +75,11 @@
CornerRadius="3"
Watermark="{DynamicResource Text.Clone.AdditionalParam.Placeholder}"
Text="{Binding ExtraArgs, Mode=TwoWay}"/>
<CheckBox Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Clone.RecurseSubmodules}"
IsChecked="{Binding InitAndUpdateSubmodules, Mode=TwoWay}"
ToolTip.Tip="--recurse-submodules"/>
</Grid>
</StackPanel>
</UserControl>