feature: display commit's detail info even if the commit is not shown in histories

This commit is contained in:
leo 2024-09-19 14:38:11 +08:00
parent 5574dd2c38
commit 0ed1f369e9
No known key found for this signature in database

View file

@ -113,11 +113,19 @@ namespace SourceGit.ViewModels
public void NavigateTo(string commitSHA) public void NavigateTo(string commitSHA)
{ {
var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA, StringComparison.Ordinal)); 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; AutoSelectedCommit = commit;
NavigationId = _navigationId + 1; NavigationId = _navigationId + 1;
}
if (commit != null)
{
if (_detailContext is CommitDetail detail) if (_detailContext is CommitDetail detail)
{ {
detail.Commit = commit; detail.Commit = commit;
@ -129,6 +137,10 @@ namespace SourceGit.ViewModels
DetailContext = commitDetail; DetailContext = commitDetail;
} }
} }
else
{
DetailContext = null;
}
} }
public void Select(IList commits) public void Select(IList commits)