Skip to content

Commit

Permalink
Make showing commit message body in the revision graph optional (gite…
Browse files Browse the repository at this point in the history
  • Loading branch information
jwfx committed Jun 21, 2021
1 parent d53de35 commit 2c32e7e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions GitCommands/Settings/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,12 @@ public static int RevisionGridQuickSearchTimeout
set => SetInt("revisiongridquicksearchtimeout", value);
}

public static bool ShowCommitBodyInRevisionGrid
{
get => GetBool("ShowCommitBodyInRevisionGrid", true);
set => SetBool("ShowCommitBodyInRevisionGrid", value);
}

/// <summary>Gets or sets the path to the git application executable.</summary>
public static string GitBinDir
{
Expand Down
2 changes: 1 addition & 1 deletion GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 4 additions & 0 deletions GitUI/Translation/English.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8867,6 +8867,10 @@ See the changes in the commit form.</source>
<source>Show build status text</source>
<target />
</trans-unit>
<trans-unit id="showCommitMessageBodyToolStripMenuItem.Text">
<source>Show commit message body</source>
<target />
</trans-unit>
<trans-unit id="showDateColumnToolStripMenuItem.Text">
<source>Show date column</source>
<target />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ private IReadOnlyList<MenuCommand> CreateViewMenuCommands()
ExecuteAction = () => _revisionGrid.ToggleShowGitNotes(),
IsCheckedFunc = () => AppSettings.ShowGitNotes
},
new MenuCommand
{
Name = "showCommitMessageBodyToolStripMenuItem",
Text = "Show commit message body",
ExecuteAction = () => _revisionGrid.ToggleShowCommitBodyInRevisionGrid(),
IsCheckedFunc = () => AppSettings.ShowCommitBodyInRevisionGrid
},

MenuCommand.CreateSeparator(),

Expand Down
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2c32e7e

Please sign in to comment.