mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: allow edit commit message only with Amend
(#336)
This commit is contained in:
parent
97d5ecdfe9
commit
eb441852b0
1 changed files with 21 additions and 13 deletions
|
@ -1239,24 +1239,32 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_count == 0)
|
|
||||||
{
|
|
||||||
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!AutoStageBeforeCommit && _staged.Count == 0)
|
|
||||||
{
|
|
||||||
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(_commitMessage))
|
if (string.IsNullOrWhiteSpace(_commitMessage))
|
||||||
{
|
{
|
||||||
App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!");
|
App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_useAmend)
|
||||||
|
{
|
||||||
|
if (AutoStageBeforeCommit)
|
||||||
|
{
|
||||||
|
if (_count == 0)
|
||||||
|
{
|
||||||
|
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_staged.Count == 0)
|
||||||
|
{
|
||||||
|
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IsCommitting = true;
|
IsCommitting = true;
|
||||||
_repo.Settings.PushCommitMessage(_commitMessage);
|
_repo.Settings.PushCommitMessage(_commitMessage);
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
|
Loading…
Reference in a new issue