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) {