diff --git a/src/Converters/StringConverters.cs b/src/Converters/StringConverters.cs index 5e4608c5..bcadfae9 100644 --- a/src/Converters/StringConverters.cs +++ b/src/Converters/StringConverters.cs @@ -81,5 +81,8 @@ namespace SourceGit.Converters public static readonly FuncValueConverter ContainsSpaces = new FuncValueConverter(v => v != null && v.Contains(' ')); + + public static readonly FuncValueConverter IsNotNullOrWhitespace = + new FuncValueConverter(v => v != null && v.Trim().Length > 0); } } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index a0933ea3..784328cc 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1652,6 +1652,9 @@ namespace SourceGit.ViewModels private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty = false, bool confirmWithFilter = false) { + if (string.IsNullOrWhiteSpace(_commitMessage)) + return; + if (!_repo.CanCreatePopup()) { App.RaiseException(_repo.FullPath, "Repository has unfinished job! Please wait!"); @@ -1672,12 +1675,6 @@ namespace SourceGit.ViewModels return; } - if (string.IsNullOrWhiteSpace(_commitMessage)) - { - App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!"); - return; - } - if (!_useAmend && !allowEmpty) { if ((autoStage && _count == 0) || (!autoStage && _staged.Count == 0)) diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index 94dd0c30..4ca854fa 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -295,7 +295,9 @@ - + @@ -309,7 +311,6 @@ Command="{Binding Commit}" HotKey="{OnPlatform Ctrl+Enter, macOS=⌘+Enter}" IsVisible="{Binding InProgressContext, Converter={x:Static ObjectConverters.IsNull}}" - IsEnabled="{Binding !IsCommitting}" ToolTip.Placement="Top" ToolTip.VerticalOffset="0"> @@ -324,6 +325,13 @@ + + + + + + + @@ -331,8 +339,14 @@ Width="0" Height="0" Background="Transparent" Command="{Binding CommitWithAutoStage}" - HotKey="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+Shift+Enter}" - IsEnabled="{Binding !IsCommitting}"/> + HotKey="{OnPlatform Ctrl+Shift+Enter, macOS=⌘+Shift+Enter}"> + + + + + + +