From 0ed1f369e9f22ad1e0d03aa08472cca85a51a39b Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 19 Sep 2024 14:38:11 +0800 Subject: [PATCH] feature: display commit's detail info even if the commit is not shown in histories --- src/ViewModels/Histories.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 662d58fa..b5a72763 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -113,11 +113,19 @@ namespace SourceGit.ViewModels public void NavigateTo(string commitSHA) { var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA, StringComparison.Ordinal)); - if (commit != null) + if (commit == null) + { + AutoSelectedCommit = null; + commit = new Commands.QuerySingleCommit(_repo.FullPath, commitSHA).Result(); + } + else { AutoSelectedCommit = commit; NavigationId = _navigationId + 1; + } + if (commit != null) + { if (_detailContext is CommitDetail detail) { detail.Commit = commit; @@ -129,6 +137,10 @@ namespace SourceGit.ViewModels DetailContext = commitDetail; } } + else + { + DetailContext = null; + } } public void Select(IList commits)