diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 6adf0e270..e670b0577 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -856,6 +856,8 @@ INCLUDE UNTRACKED FILES NO RECENT INPUT MESSAGES NO COMMIT TEMPLATES + Clear History + Are you sure you want to clear all commit message history? This action cannot be undone. Reset Author SignOff STAGED diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 8a035d61a..162dbfc3b 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -606,6 +606,15 @@ public void ApplyCommitMessageTemplate(Models.CommitTemplate tmpl) CommitMessage = tmpl.Apply(_repo.CurrentBranch, _staged); } + public async Task ClearCommitMessageHistory() + { + if (await App.AskConfirmAsync(App.Text("WorkingCopy.ConfirmClearHistories"))) + Dispatcher.UIThread.Invoke(() => + { + _repo.Settings.CommitMessages.Clear(); + }); + } + public async Task CommitAsync(bool autoStage, bool autoPush, Models.CommitCheckPassed checkPassed = Models.CommitCheckPassed.None) { if (string.IsNullOrWhiteSpace(_commitMessage)) diff --git a/src/Views/CommitMessageTextBox.axaml.cs b/src/Views/CommitMessageTextBox.axaml.cs index 80b3c4a53..a4edfd889 100644 --- a/src/Views/CommitMessageTextBox.axaml.cs +++ b/src/Views/CommitMessageTextBox.axaml.cs @@ -269,6 +269,21 @@ private async void OnOpenCommitMessagePicker(object sender, RoutedEventArgs e) menu.Items.Add(item); } + + menu.Items.Add(new MenuItem() { Header = "-" }); + + var clearHistoryItem = new MenuItem() + { + Header = App.Text("WorkingCopy.ClearCommitHistories"), + Icon = App.CreateMenuIcon("Icons.Clear") + }; + clearHistoryItem.Click += async (_, e) => + { + await vm.ClearCommitMessageHistory(); + e.Handled = true; + }; + + menu.Items.Add(clearHistoryItem); } menu.Placement = PlacementMode.TopEdgeAlignedLeft;