enhance: supports to configure fetch.prune for selected repository (#995)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-21 09:44:51 +08:00
parent b5feabfd37
commit 9da2c787db
No known key found for this signature in database
2 changed files with 15 additions and 2 deletions

View file

@ -60,6 +60,12 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _httpProxy, value); set => SetProperty(ref _httpProxy, value);
} }
public bool EnablePruneOnFetch
{
get;
set;
}
public bool EnableAutoFetch public bool EnableAutoFetch
{ {
get => _repo.Settings.EnableAutoFetch; get => _repo.Settings.EnableAutoFetch;
@ -153,6 +159,8 @@ namespace SourceGit.ViewModels
GPGUserSigningKey = signingKey; GPGUserSigningKey = signingKey;
if (_cached.TryGetValue("http.proxy", out var proxy)) if (_cached.TryGetValue("http.proxy", out var proxy))
HttpProxy = proxy; HttpProxy = proxy;
if (_cached.TryGetValue("fetch.prune", out var prune))
EnablePruneOnFetch = (prune == "true");
} }
public void ClearHttpProxy() public void ClearHttpProxy()
@ -286,6 +294,7 @@ namespace SourceGit.ViewModels
SetIfChanged("tag.gpgsign", GPGTagSigningEnabled ? "true" : "false", "false"); SetIfChanged("tag.gpgsign", GPGTagSigningEnabled ? "true" : "false", "false");
SetIfChanged("user.signingkey", GPGUserSigningKey, ""); SetIfChanged("user.signingkey", GPGUserSigningKey, "");
SetIfChanged("http.proxy", HttpProxy, ""); SetIfChanged("http.proxy", HttpProxy, "");
SetIfChanged("fetch.prune", EnablePruneOnFetch ? "true" : "false", "false");
} }
private void SetIfChanged(string key, string value, string defValue) private void SetIfChanged(string key, string value, string defValue)

View file

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