Merge pull request #282 from RevenantX/copy_commit_info

Add copy info that copies "{Short SHA} - {commit subject}" into clipboard
This commit is contained in:
leo 2024-07-24 10:35:42 +08:00
commit 114e5f8c1a
No known key found for this signature in database
2 changed files with 12 additions and 0 deletions

View file

@ -97,6 +97,7 @@
<x:String x:Key="Text.CommitCM.CompareWithHead" xml:space="preserve">Compare with HEAD</x:String>
<x:String x:Key="Text.CommitCM.CompareWithWorktree" xml:space="preserve">Compare with Worktree</x:String>
<x:String x:Key="Text.CommitCM.CopySHA" xml:space="preserve">Copy SHA</x:String>
<x:String x:Key="Text.CommitCM.CopyInfo" xml:space="preserve">Copy Info</x:String>
<x:String x:Key="Text.CommitCM.InteractiveRebase" xml:space="preserve">Interactive Rebase ${0}$ to Here</x:String>
<x:String x:Key="Text.CommitCM.Rebase" xml:space="preserve">Rebase ${0}$ to Here</x:String>
<x:String x:Key="Text.CommitCM.Reset" xml:space="preserve">Reset ${0}$ to Here</x:String>

View file

@ -435,6 +435,17 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
menu.Items.Add(copySHA);
var copyInfo = new MenuItem();
copyInfo.Header = App.Text("CommitCM.CopyInfo");
copyInfo.Icon = App.CreateMenuIcon("Icons.Copy");
copyInfo.Click += (_, e) =>
{
App.CopyText($"{commit.SHA[..7]} - {commit.Subject}");
e.Handled = true;
};
menu.Items.Add(copyInfo);
return menu;
}