mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
克隆远程仓库时可选指定远程名,而不是用默认的 origin
This commit is contained in:
parent
b5002cb89d
commit
232165fa3e
3 changed files with 35 additions and 7 deletions
|
@ -23,7 +23,12 @@ namespace SourceGit.UI {
|
|||
/// <summary>
|
||||
/// Local name.
|
||||
/// </summary>
|
||||
public string LocalName { get; set; }
|
||||
public string LocalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Remote name.
|
||||
/// </summary>
|
||||
public string RemoteName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue