mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
fix<Clone>: fix crash after clone a new repository
This commit is contained in:
parent
faffba09c8
commit
79084c9a9a
4 changed files with 12 additions and 9 deletions
|
@ -41,9 +41,11 @@ namespace SourceGit.ViewModels {
|
||||||
set => SetProperty(ref _extraArgs, value);
|
set => SetProperty(ref _extraArgs, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clone(LauncherPage page) {
|
public Clone(Launcher launcher, LauncherPage page) {
|
||||||
View = new Views.Clone() { DataContext = this };
|
_launcher = launcher;
|
||||||
_page = page;
|
_page = page;
|
||||||
|
|
||||||
|
View = new Views.Clone() { DataContext = this };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValidationResult ValidateRemote(string remote, ValidationContext _) {
|
public static ValidationResult ValidateRemote(string remote, ValidationContext _) {
|
||||||
|
@ -92,14 +94,14 @@ namespace SourceGit.ViewModels {
|
||||||
};
|
};
|
||||||
Preference.AddNode(node);
|
Preference.AddNode(node);
|
||||||
|
|
||||||
_page.View = new Views.Repository() { DataContext = repo };
|
_launcher.OpenRepositoryInTab(node, _page);
|
||||||
_page.Node = node;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Launcher _launcher = null;
|
||||||
private LauncherPage _page = null;
|
private LauncherPage _page = null;
|
||||||
private string _remote = string.Empty;
|
private string _remote = string.Empty;
|
||||||
private bool _useSSH = false;
|
private bool _useSSH = false;
|
||||||
|
|
|
@ -106,12 +106,12 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int WorkingCopyChangesCount {
|
public int WorkingCopyChangesCount {
|
||||||
get => _workingCopy.Count;
|
get => _workingCopy == null ? 0 : _workingCopy.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int StashesCount {
|
public int StashesCount {
|
||||||
get => _stashesPage.Count;
|
get => _stashesPage == null ? 0 : _stashesPage.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
|
@ -34,7 +34,8 @@ namespace SourceGit.ViewModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clone(object param) {
|
public void Clone(object param) {
|
||||||
var page = param as LauncherPage;
|
var launcher = param as Launcher;
|
||||||
|
var page = launcher.ActivePage;
|
||||||
|
|
||||||
if (!Preference.Instance.IsGitConfigured) {
|
if (!Preference.Instance.IsGitConfigured) {
|
||||||
App.RaiseException(page.GetId(), App.Text("NotConfigured"));
|
App.RaiseException(page.GetId(), App.Text("NotConfigured"));
|
||||||
|
@ -42,7 +43,7 @@ namespace SourceGit.ViewModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PopupHost.CanCreatePopup()) {
|
if (PopupHost.CanCreatePopup()) {
|
||||||
PopupHost.ShowPopup(new Clone(page));
|
PopupHost.ShowPopup(new Clone(launcher, page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<Path Width="15" Height="13" Data="{StaticResource Icons.Folder.Open}"/>
|
<Path Width="15" Height="13" Data="{StaticResource Icons.Folder.Open}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Classes="icon_button" Width="32" Command="{Binding Clone}" CommandParameter="{Binding $parent[v:Launcher].DataContext.(vm:Launcher).ActivePage}" ToolTip.Tip="{DynamicResource Text.Welcome.Clone}">
|
<Button Classes="icon_button" Width="32" Command="{Binding Clone}" CommandParameter="{Binding $parent[v:Launcher].DataContext}" ToolTip.Tip="{DynamicResource Text.Welcome.Clone}">
|
||||||
<Path Width="13" Height="13" Data="{StaticResource Icons.Pull}"/>
|
<Path Width="13" Height="13" Data="{StaticResource Icons.Pull}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue