mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-01 01:14:59 +00:00
enhance: prevent requesting worktree files more than once time
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
eb183589f5
commit
550493b572
1 changed files with 12 additions and 1 deletions
|
@ -294,6 +294,7 @@ namespace SourceGit.ViewModels
|
|||
SelectedSearchedCommit = null;
|
||||
SearchCommitFilter = string.Empty;
|
||||
MatchedFilesForSearching = null;
|
||||
_requestingWorktreeFiles = false;
|
||||
_worktreeFiles = null;
|
||||
}
|
||||
}
|
||||
|
@ -568,6 +569,7 @@ namespace SourceGit.ViewModels
|
|||
_searchedCommits.Clear();
|
||||
_selectedSearchedCommit = null;
|
||||
|
||||
_requestingWorktreeFiles = false;
|
||||
_worktreeFiles = null;
|
||||
_matchedFilesForSearching = null;
|
||||
}
|
||||
|
@ -2698,19 +2700,27 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
if (!IsSearchingCommitsByFilePath())
|
||||
{
|
||||
_requestingWorktreeFiles = false;
|
||||
_worktreeFiles = null;
|
||||
MatchedFilesForSearching = null;
|
||||
GC.Collect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_requestingWorktreeFiles)
|
||||
return;
|
||||
|
||||
_requestingWorktreeFiles = true;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
_worktreeFiles = new Commands.QueryRevisionFileNames(_fullpath, "HEAD").Result();
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
if (IsSearchingCommitsByFilePath())
|
||||
if (IsSearchingCommitsByFilePath() && _requestingWorktreeFiles)
|
||||
CalcMatchedFilesForSearching();
|
||||
|
||||
_requestingWorktreeFiles = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -2796,6 +2806,7 @@ namespace SourceGit.ViewModels
|
|||
private string _searchCommitFilter = string.Empty;
|
||||
private List<Models.Commit> _searchedCommits = new List<Models.Commit>();
|
||||
private Models.Commit _selectedSearchedCommit = null;
|
||||
private bool _requestingWorktreeFiles = false;
|
||||
private List<string> _worktreeFiles = null;
|
||||
private List<string> _matchedFilesForSearching = null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue