From 91f3f1263acbab4153c6a61dc5a2edfaf0f5a409 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 28 Jan 2021 15:04:57 +0800 Subject: [PATCH] feature: support additional parameters to clone remote repository --- src/Git/Repository.cs | 12 ++++++++---- src/Resources/Locales/en_US.xaml | 2 ++ src/Resources/Locales/zh_CN.xaml | 2 ++ src/UI/Clone.xaml | 18 ++++++++++++------ src/UI/Clone.xaml.cs | 7 ++++++- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/Git/Repository.cs b/src/Git/Repository.cs index d0bccb04..39a30766 100644 --- a/src/Git/Repository.cs +++ b/src/Git/Repository.cs @@ -412,18 +412,22 @@ namespace SourceGit.Git { /// /// Remote repository URL /// Folder to clone into - /// Local name + /// Remote name + /// Local name + /// Additional parameters /// /// - public static bool Clone(string url, string folder, string rName, string lName, Action onProgress) { + public static bool Clone(string url, string folder, string rName, string lName, string extra, Action onProgress) { string RemoteName; if (rName != null) { RemoteName = $" --origin {rName}"; } else { - RemoteName = null; + RemoteName = ""; } - var errs = RunCommand(folder, $"-c credential.helper=manager clone --progress --verbose {RemoteName} --recurse-submodules {url} {lName}", line => { + if (extra == null) extra = ""; + + var errs = RunCommand(folder, $"-c credential.helper=manager clone --progress --verbose {RemoteName} --recurse-submodules {extra} {url} {lName}", line => { if (line != null) onProgress?.Invoke(line); }, true); diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 6db0cd9c..8be16e7f 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -65,6 +65,8 @@ Repository name. Optional. Remote Name : Remote name. Optional. + Extra Parameters : + Additional arguments to clone repository. Optional. INFORMATION AUTHOR diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index a7071c4d..b0121cec 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -65,6 +65,8 @@ 本地仓库目录的名字,选填 远程名 : 远程的名字,选填 + 额外参数 : + 其他克隆参数,选填 基本信息 修改者 diff --git a/src/UI/Clone.xaml b/src/UI/Clone.xaml index 24691f98..abff5f00 100644 --- a/src/UI/Clone.xaml +++ b/src/UI/Clone.xaml @@ -6,7 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:helpers="clr-namespace:SourceGit.Helpers" mc:Ignorable="d" - Width="500" Height="224"> + Width="500" Height="256"> @@ -15,6 +15,7 @@ + @@ -68,18 +69,23 @@ VerticalContentAlignment="Center" Height="24" helpers:TextBoxHelper.Placeholder="{StaticResource Text.Clone.LocalName.Placeholder}" - Text="{Binding LocalName, ElementName=me, Mode=TwoWay}"> - + Text="{Binding LocalName, ElementName=me, Mode=TwoWay}"/>