enhance: allow edit commit message only with Amend (#336)

This commit is contained in:
leo 2024-08-08 15:18:35 +08:00
parent 97d5ecdfe9
commit eb441852b0
No known key found for this signature in database

View file

@ -1239,22 +1239,30 @@ namespace SourceGit.ViewModels
return;
}
if (string.IsNullOrWhiteSpace(_commitMessage))
{
App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!");
return;
}
if (!_useAmend)
{
if (AutoStageBeforeCommit)
{
if (_count == 0)
{
App.RaiseException(_repo.FullPath, "No files added to commit!");
return;
}
if (!AutoStageBeforeCommit && _staged.Count == 0)
}
else
{
if (_staged.Count == 0)
{
App.RaiseException(_repo.FullPath, "No files added to commit!");
return;
}
if (string.IsNullOrWhiteSpace(_commitMessage))
{
App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!");
return;
}
}
IsCommitting = true;