enhance: make commit's subject the same with pretty print parameter %s in git log command

This commit is contained in:
leo 2024-06-07 12:31:10 +08:00
parent b4e01a8b93
commit 78c7168a46
No known key found for this signature in database
GPG key ID: B528468E49CD0E58
6 changed files with 98 additions and 83 deletions

View file

@ -84,17 +84,25 @@ namespace SourceGit.ViewModels
{
if (SetProperty(ref _useAmend, value) && value)
{
var commits = new Commands.QueryCommits(_repo.FullPath, "-n 1", false).Result();
if (commits.Count == 0)
var currentBranch = _repo.Branches.Find(x => x.IsCurrent);
if (currentBranch == null)
{
App.RaiseException(_repo.FullPath, "No commits to amend!!!");
_useAmend = false;
OnPropertyChanged();
return;
}
else
var head = new Commands.QuerySingleCommit(_repo.FullPath, currentBranch.Head).Result();
if (head == null)
{
CommitMessage = commits[0].Body;
App.RaiseException(_repo.FullPath, "No commits to amend!!!");
_useAmend = false;
OnPropertyChanged();
return;
}
CommitMessage = head.Body;
}
OnPropertyChanged(nameof(IsCommitWithPushVisible));