mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 02:12:25 +08:00
fix<Submodules>: compatible with un-inited submodule
This commit is contained in:
@@ -3,7 +3,8 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
public class QuerySubmodules : Command {
|
||||
private readonly Regex REG_FORMAT = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$");
|
||||
private readonly Regex REG_FORMAT1 = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$");
|
||||
private readonly Regex REG_FORMAT2 = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)$");
|
||||
|
||||
public QuerySubmodules(string repo) {
|
||||
WorkingDirectory = repo;
|
||||
@@ -17,9 +18,16 @@ namespace SourceGit.Commands {
|
||||
}
|
||||
|
||||
protected override void OnReadline(string line) {
|
||||
var match = REG_FORMAT.Match(line);
|
||||
if (!match.Success) return;
|
||||
_submodules.Add(match.Groups[1].Value);
|
||||
var match = REG_FORMAT1.Match(line);
|
||||
if (match.Success) {
|
||||
_submodules.Add(match.Groups[1].Value);
|
||||
return;
|
||||
}
|
||||
|
||||
match = REG_FORMAT2.Match(line);
|
||||
if (match.Success) {
|
||||
_submodules.Add(match.Groups[1].Value);
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _submodules = new List<string>();
|
||||
|
||||
@@ -444,8 +444,10 @@ namespace SourceGit.ViewModels {
|
||||
|
||||
var commits = new Commands.QueryCommits(FullPath, limits).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
_histories.IsLoading = false;
|
||||
_histories.Commits = commits;
|
||||
if (_histories != null) {
|
||||
_histories.IsLoading = false;
|
||||
_histories.Commits = commits;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -488,7 +490,7 @@ namespace SourceGit.ViewModels {
|
||||
public void RefreshStashes() {
|
||||
var stashes = new Commands.QueryStashes(FullPath).Result();
|
||||
Dispatcher.UIThread.Invoke(() => {
|
||||
_stashesPage.Stashes = stashes;
|
||||
if (_stashesPage != null) _stashesPage.Stashes = stashes;
|
||||
OnPropertyChanged(nameof(StashesCount));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user