feature: add --simplify-by-decoration mode support (#1595)

This commit is contained in:
heartacker
2025-07-18 15:49:31 +08:00
committed by leo
parent 5ee345638f
commit 9f155d7b32
4 changed files with 40 additions and 2 deletions

View File

@@ -14,6 +14,12 @@ namespace SourceGit.Models
set;
} = string.Empty;
public bool SimplifyByDecoration
{
get;
set;
} = false;
public bool EnableReflog
{
get;

View File

@@ -670,6 +670,7 @@
<x:String x:Key="Text.Repository.Search.InCurrentBranch" xml:space="preserve">Current Branch</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Show first-parent only</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Show lost commits</x:String>
<x:String x:Key="Text.Repository.SimplifyByDecoration" xml:space="preserve">Show Decorate Commits Only</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Show Submodules as Tree</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
<x:String x:Key="Text.Repository.Skip" xml:space="preserve">SKIP</x:String>

View File

@@ -91,6 +91,20 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _selectedView, value);
}
public bool SimplifyByDecoration
{
get => _settings.SimplifyByDecoration;
set
{
if (value != _settings.SimplifyByDecoration)
{
_settings.SimplifyByDecoration = value;
OnPropertyChanged();
Task.Run(RefreshCommits);
}
}
}
public bool EnableReflog
{
get => _settings.EnableReflog;
@@ -1271,6 +1285,9 @@ namespace SourceGit.ViewModels
builder.Append("--reflog ");
if (_settings.EnableFirstParentInHistories)
builder.Append("--first-parent ");
// only show commits with decorators
if (_settings.SimplifyByDecoration)
builder.Append("--simplify-by-decoration ");
var filters = _settings.BuildHistoriesFilter();
if (string.IsNullOrEmpty(filters))

View File

@@ -83,7 +83,7 @@
</ListBox.ItemsPanel>
<ListBoxItem>
<Grid Classes="view_mode" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto,Auto">
<Grid Classes="view_mode" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto,Auto,Auto">
<Path Grid.Column="0" Classes="icon" Data="{StaticResource Icons.Histories}"/>
<TextBlock Grid.Column="1" Classes="header" Text="{DynamicResource Text.Histories}"/>
@@ -131,7 +131,21 @@
ToolTip.Tip="{DynamicResource Text.Repository.UseRelativeTimeInGraph}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Stopwatch}"/>
</ToggleButton>
<Button Grid.Column="6"
<ToggleButton Grid.Column="6"
Classes="line_path"
Width="26" Height="26"
Background="Transparent"
IsChecked="{Binding SimplifyByDecoration, Mode=TwoWay}">
<ToolTip.Tip>
<TextBlock>
<Run Text="{DynamicResource Text.Repository.SimplifyByDecoration}"/>
<Run Text=" "/>
<Run Text="--simplify-by-decoration" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
</TextBlock>
</ToolTip.Tip>
<Path Width="12" Height="12" Data="{StaticResource Icons.Tree}"/>
</ToggleButton>
<Button Grid.Column="7"
Classes="icon_button"
Width="26" Height="26"
Click="OnOpenAdvancedHistoriesOption">