refactor: move per-repository config Enable --prune on fetch to global git config fetch.prune (#908)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-01-25 12:06:48 +08:00
parent aad42a8297
commit fa07bb5b5a
No known key found for this signature in database
20 changed files with 32 additions and 42 deletions

View file

@ -255,7 +255,7 @@
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.Git}"/>
</TabItem.Header>
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="Auto,*">
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preferences.Git.Path}"
HorizontalAlignment="Right"
@ -329,6 +329,11 @@
</ComboBox>
<CheckBox Grid.Row="5" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preferences.Git.EnablePruneOnFetch}"
IsChecked="{Binding #ThisControl.EnablePruneOnFetch, Mode=TwoWay}"/>
<CheckBox Grid.Row="6" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preferences.Git.SSLVerify}"
IsChecked="{Binding #ThisControl.EnableHTTPSSLVerify, Mode=TwoWay}"/>

View file

@ -28,6 +28,12 @@ namespace SourceGit.Views
set;
} = null;
public bool EnablePruneOnFetch
{
get;
set;
}
public static readonly StyledProperty<string> GitVersionProperty =
AvaloniaProperty.Register<Preferences, string>(nameof(GitVersion));
@ -114,6 +120,8 @@ namespace SourceGit.Views
GPGUserKey = signingKey;
if (config.TryGetValue("core.autocrlf", out var crlf))
CRLFMode = Models.CRLFMode.Supported.Find(x => x.Value == crlf);
if (config.TryGetValue("fetch.prune", out var pruneOnFetch))
EnablePruneOnFetch = (pruneOnFetch == "true");
if (config.TryGetValue("commit.gpgsign", out var gpgCommitSign))
EnableGPGCommitSigning = (gpgCommitSign == "true");
if (config.TryGetValue("tag.gpgsign", out var gpgTagSign))
@ -157,6 +165,7 @@ namespace SourceGit.Views
SetIfChanged(config, "user.email", DefaultEmail, "");
SetIfChanged(config, "user.signingkey", GPGUserKey, "");
SetIfChanged(config, "core.autocrlf", CRLFMode != null ? CRLFMode.Value : null, null);
SetIfChanged(config, "fetch.prune", EnablePruneOnFetch ? "true" : "false", "false");
SetIfChanged(config, "commit.gpgsign", EnableGPGCommitSigning ? "true" : "false", "false");
SetIfChanged(config, "tag.gpgsign", EnableGPGTagSigning ? "true" : "false", "false");
SetIfChanged(config, "http.sslverify", EnableHTTPSSLVerify ? "" : "false", "");

View file

@ -45,7 +45,7 @@
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Configure.Git}"/>
</TabItem.Header>
<Grid Margin="16,4,16,8" RowDefinitions="32,32,32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
<Grid Margin="16,4,16,8" RowDefinitions="32,32,32,32,32,32,32,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@ -120,11 +120,7 @@
Content="{DynamicResource Text.Preferences.GPG.TagEnabled}"
IsChecked="{Binding GPGTagSigningEnabled, Mode=TwoWay}"/>
<CheckBox Grid.Row="7" Grid.Column="1"
Content="{DynamicResource Text.Configure.Git.EnablePruneOnFetch}"
IsChecked="{Binding EnablePruneOnFetch, Mode=TwoWay}"/>
<StackPanel Grid.Row="8" Grid.Column="1" Orientation="Horizontal">
<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal">
<CheckBox x:Name="AutoFetchCheckBox"
Content="{DynamicResource Text.Configure.Git.AutoFetch}"
IsChecked="{Binding EnableAutoFetch, Mode=TwoWay}"/>