code_review: PR #1472

Move `Commands.IsCommitSHA` testing from `Commands.QuerySingleCommit` to `ViewModels.Repository.StartSearchCommits`,  because we only need test the SHA user typed in

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-06-30 10:05:49 +08:00
parent 8602ba2fc3
commit 61372e2ffd
2 changed files with 7 additions and 13 deletions

View File

@@ -871,13 +871,17 @@ namespace SourceGit.ViewModels
Task.Run(() =>
{
List<Models.Commit> visible;
List<Models.Commit> visible = [];
var method = (Models.CommitSearchMethod)_searchCommitFilterType;
if (method == Models.CommitSearchMethod.BySHA)
{
var commit = new Commands.QuerySingleCommit(_fullpath, _searchCommitFilter).Result();
visible = commit == null ? [] : [commit];
var isCommitSHA = new Commands.IsCommitSHA(_fullpath, _searchCommitFilter).Result();
if (isCommitSHA)
{
var commit = new Commands.QuerySingleCommit(_fullpath, _searchCommitFilter).Result();
visible = [commit];
}
}
else
{