code_review: PR #1055

- since the author and time are already shown in the blame view, use the full message as tooltip is better.
- cache the commit message in `ViewModels.Blame` since the `Tooltip` of control may change.
- querying commit message synchronously (it's very fast) to avoid similar issues in commit details panel.

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-05 09:54:23 +08:00
parent 269903503f
commit fb8d4a2542
No known key found for this signature in database
3 changed files with 17 additions and 43 deletions

View file

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading.Tasks;
using Avalonia.Threading;
@ -57,12 +58,18 @@ namespace SourceGit.ViewModels
}
}
public Models.Commit GetCommitInfo(string commitSHA)
public string GetCommitMessage(string sha)
{
return new Commands.QuerySingleCommit(_repo, commitSHA).Result();
if (_commitMessages.TryGetValue(sha, out var msg))
return msg;
msg = new Commands.QueryCommitFullMessage(_repo, sha).Result();
_commitMessages[sha] = msg;
return msg;
}
private readonly string _repo;
private Models.BlameData _data = null;
private Dictionary<string, string> _commitMessages = new Dictionary<string, string>();
}
}