feature: supports to copy full commit message (#1521)

Co-authored-by: leo <longshuang@msn.cn>
This commit is contained in:
heartacker
2025-07-05 21:23:45 +08:00
committed by GitHub
parent 24fcaa1e4c
commit 08af39de34
2 changed files with 13 additions and 0 deletions

View File

@@ -120,6 +120,7 @@
<x:String x:Key="Text.CommitCM.CompareWithWorktree" xml:space="preserve">Compare with Worktree</x:String>
<x:String x:Key="Text.CommitCM.CopyAuthor" xml:space="preserve">Author</x:String>
<x:String x:Key="Text.CommitCM.CopyCommitter" xml:space="preserve">Committer</x:String>
<x:String x:Key="Text.CommitCM.CopyCommitMessage" xml:space="preserve">Message</x:String>
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">SHA</x:String>
<x:String x:Key="Text.CommitCM.CopySubject" xml:space="preserve">Subject</x:String>
<x:String x:Key="Text.CommitCM.CustomAction" xml:space="preserve">Custom Action</x:String>

View File

@@ -845,6 +845,17 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
var copyFullInfo = new MenuItem();
copyFullInfo.Header = App.Text("CommitCM.CopyCommitMessage");
copyFullInfo.Icon = App.CreateMenuIcon("Icons.Info");
copyFullInfo.Click += async (_, e) =>
{
var message = await new Commands.QueryCommitFullMessage(_repo.FullPath, commit.SHA).
GetResultAsync().ConfigureAwait(false);
await App.CopyTextAsync(message);
e.Handled = true;
};
var copyAuthor = new MenuItem();
copyAuthor.Header = App.Text("CommitCM.CopyAuthor");
copyAuthor.Icon = App.CreateMenuIcon("Icons.User");
@@ -869,6 +880,7 @@ namespace SourceGit.ViewModels
copy.Items.Add(copySHA);
copy.Items.Add(copySubject);
copy.Items.Add(copyInfo);
copy.Items.Add(copyFullInfo);
copy.Items.Add(copyAuthor);
copy.Items.Add(copyCommitter);
menu.Items.Add(copy);