From 232165fa3eafdd0d5589963f0a26a487e7075bcf Mon Sep 17 00:00:00 2001
From: ZCShou <72115@163.com>
Date: Fri, 17 Jul 2020 10:00:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=8B=E9=9A=86=E8=BF=9C=E7=A8=8B=E4=BB=93?=
=?UTF-8?q?=E5=BA=93=E6=97=B6=E5=8F=AF=E9=80=89=E6=8C=87=E5=AE=9A=E8=BF=9C?=
=?UTF-8?q?=E7=A8=8B=E5=90=8D=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E7=94=A8?=
=?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=20origin?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SourceGit/Git/Repository.cs | 6 +++---
SourceGit/UI/Clone.xaml | 13 +++++++++++--
SourceGit/UI/Clone.xaml.cs | 23 +++++++++++++++++++++--
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/SourceGit/Git/Repository.cs b/SourceGit/Git/Repository.cs
index 161ea027..48e32b85 100644
--- a/SourceGit/Git/Repository.cs
+++ b/SourceGit/Git/Repository.cs
@@ -391,8 +391,8 @@ namespace SourceGit.Git {
/// Local name
///
///
- public static Repository Clone(string url, string folder, string name, Action onProgress) {
- var errs = RunCommand(folder, $"-c credential.helper=manager clone --progress --verbose --recurse-submodules {url} {name}", line => {
+ public static Repository Clone(string url, string folder, string rName, string lName, Action onProgress) {
+ var errs = RunCommand(folder, $"-c credential.helper=manager clone --progress --verbose --origin {rName} --recurse-submodules {url} {lName}", line => {
if (line != null) onProgress?.Invoke(line);
}, true);
@@ -401,7 +401,7 @@ namespace SourceGit.Git {
return null;
}
- var path = new DirectoryInfo(folder + "/" + name).FullName;
+ var path = new DirectoryInfo(folder + "/" + lName).FullName;
var repo = Preference.Instance.AddRepository(path, "");
return repo;
}
diff --git a/SourceGit/UI/Clone.xaml b/SourceGit/UI/Clone.xaml
index 119246eb..9ba6304f 100644
--- a/SourceGit/UI/Clone.xaml
+++ b/SourceGit/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="192">
+ Width="500" Height="224">
@@ -14,6 +14,7 @@
+
@@ -70,7 +71,15 @@
Text="{Binding LocalName, ElementName=me, Mode=TwoWay}">
-
+
+
+
+
+
diff --git a/SourceGit/UI/Clone.xaml.cs b/SourceGit/UI/Clone.xaml.cs
index a5c8b50c..ef82134b 100644
--- a/SourceGit/UI/Clone.xaml.cs
+++ b/SourceGit/UI/Clone.xaml.cs
@@ -23,7 +23,12 @@ namespace SourceGit.UI {
///
/// Local name.
///
- public string LocalName { get; set; }
+ public string LocalName { get; set; }
+
+ ///
+ /// Remote name.
+ ///
+ public string RemoteName { get; set; }
///
/// Constructor.
@@ -77,12 +82,26 @@ namespace SourceGit.UI {
repoName = name.Replace(".git", "");
} else {
repoName = LocalName;
+ }
+
+ string rName;
+ if (string.IsNullOrWhiteSpace(RemoteName))
+ {
+ var from = RemoteUri.LastIndexOfAny(new char[] { '\\', '/' });
+ if (from <= 0) return;
+
+ var name = RemoteUri.Substring(from + 1);
+ rName = name.Replace(".git", "");
+ }
+ else
+ {
+ rName = RemoteName;
}
PopupManager.Lock();
var repo = await Task.Run(() => {
- return Git.Repository.Clone(RemoteUri, ParentFolder, repoName, PopupManager.UpdateStatus);
+ return Git.Repository.Clone(RemoteUri, ParentFolder, rName, repoName, PopupManager.UpdateStatus);
});
if (repo == null) {