diff --git a/GitCommands/Settings/AppSettings.cs b/GitCommands/Settings/AppSettings.cs index 77e4a70f472..813a10bb0e3 100644 --- a/GitCommands/Settings/AppSettings.cs +++ b/GitCommands/Settings/AppSettings.cs @@ -1259,6 +1259,12 @@ public static int RevisionGridQuickSearchTimeout set => SetInt("revisiongridquicksearchtimeout", value); } + public static bool ShowCommitBodyInRevisionGrid + { + get => GetBool("ShowCommitBodyInRevisionGrid", true); + set => SetBool("ShowCommitBodyInRevisionGrid", value); + } + /// Gets or sets the path to the git application executable. public static string GitBinDir { diff --git a/GitUI/CommandsDialogs/FormBrowse.cs b/GitUI/CommandsDialogs/FormBrowse.cs index da27679f095..96ca72eaf59 100644 --- a/GitUI/CommandsDialogs/FormBrowse.cs +++ b/GitUI/CommandsDialogs/FormBrowse.cs @@ -849,7 +849,7 @@ private void RefreshSelection() FillCommitInfo(selectedRevision); // If the revision's body has been updated then the grid needs to be refreshed to display it - if (selectedRevision is not null && selectedRevision.HasMultiLineMessage && oldBody != selectedRevision.Body) + if (AppSettings.ShowCommitBodyInRevisionGrid && selectedRevision is not null && selectedRevision.HasMultiLineMessage && oldBody != selectedRevision.Body) { RevisionGrid.Refresh(); } diff --git a/GitUI/Translation/English.xlf b/GitUI/Translation/English.xlf index e319c0cc156..331b1e2d9b4 100644 --- a/GitUI/Translation/English.xlf +++ b/GitUI/Translation/English.xlf @@ -8867,6 +8867,10 @@ See the changes in the commit form. Show build status text + + Show commit message body + + Show date column diff --git a/GitUI/UserControls/RevisionGrid/Columns/MessageColumnProvider.cs b/GitUI/UserControls/RevisionGrid/Columns/MessageColumnProvider.cs index 53ebb3c1d9f..cf7d616a588 100644 --- a/GitUI/UserControls/RevisionGrid/Columns/MessageColumnProvider.cs +++ b/GitUI/UserControls/RevisionGrid/Columns/MessageColumnProvider.cs @@ -404,7 +404,7 @@ void DrawSuperProjectRef(string label, ref int currentOffset) return; } - if (lines.Length > 1) + if (lines.Length > 1 && AppSettings.ShowCommitBodyInRevisionGrid) { var commitBody = string.Concat(lines.Skip(1).Select(_ => " " + _)); var bodyBounds = messageBounds.ReduceLeft(offset); diff --git a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs index 56018ddaa17..103a02f1018 100644 --- a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs +++ b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs @@ -2185,6 +2185,13 @@ internal void ToggleShowMergeCommits() ForceRefreshRevisions(); } + internal void ToggleShowCommitBodyInRevisionGrid() + { + AppSettings.ShowCommitBodyInRevisionGrid = !AppSettings.ShowCommitBodyInRevisionGrid; + MenuCommands.TriggerMenuChanged(); + Refresh(); + } + internal void ShowFirstParent() { AppSettings.ShowFirstParent = !AppSettings.ShowFirstParent; diff --git a/GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs b/GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs index e7c43ffb627..27452b1f348 100644 --- a/GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs +++ b/GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs @@ -354,6 +354,13 @@ private IReadOnlyList CreateViewMenuCommands() ExecuteAction = () => _revisionGrid.ToggleShowGitNotes(), IsCheckedFunc = () => AppSettings.ShowGitNotes }, + new MenuCommand + { + Name = "showCommitMessageBodyToolStripMenuItem", + Text = "Show commit message body", + ExecuteAction = () => _revisionGrid.ToggleShowCommitBodyInRevisionGrid(), + IsCheckedFunc = () => AppSettings.ShowCommitBodyInRevisionGrid + }, MenuCommand.CreateSeparator(), diff --git a/contributors.txt b/contributors.txt index 23d9c05762e..ca1d761f97f 100644 --- a/contributors.txt +++ b/contributors.txt @@ -158,3 +158,4 @@ YYYY/MM/DD, github id, Full name, email 2021/03/31, darkcamper, Rubén Ruiz, darkcamper(at)gmail.com 2021/05/05, mrjithil, Jithil P Ponnan, jithil(at)outlook.com 2021/05/07, dasiths, Dasith Wijesiriwardena, gitextensions.github(at)dasith.me +2021/06/18, jwfx, Jörg Winkler, jwfx at bitmx.net