revert: remove remote.<name>.pruneTags configuration support (#1692)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-08-14 10:21:35 +08:00
parent 5289d01462
commit cf5b708e16
5 changed files with 5 additions and 40 deletions

View File

@@ -612,8 +612,6 @@
<x:String x:Key="Text.Remote.EditTitle" xml:space="preserve">Edit Remote</x:String>
<x:String x:Key="Text.Remote.Name" xml:space="preserve">Name:</x:String>
<x:String x:Key="Text.Remote.Name.Placeholder" xml:space="preserve">Remote name</x:String>
<x:String x:Key="Text.Remote.PruneTagsOnFetch" xml:space="preserve">Prune tags that do not exists in this remote</x:String>
<x:String x:Key="Text.Remote.PruneTagsOnFetch.Tip" xml:space="preserve">Only works while fetching with `--prune` enabled</x:String>
<x:String x:Key="Text.Remote.URL" xml:space="preserve">Repository URL:</x:String>
<x:String x:Key="Text.Remote.URL.Placeholder" xml:space="preserve">Remote git repository URL</x:String>
<x:String x:Key="Text.RemoteCM.CopyURL" xml:space="preserve">Copy URL</x:String>

View File

@@ -44,12 +44,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _sshkey, value, true);
}
public bool PruneTagsOnFetch
{
get;
set;
} = false;
public AddRemote(Repository repo)
{
_repo = repo;
@@ -111,11 +105,6 @@ namespace SourceGit.ViewModels
.Use(log)
.SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
if (PruneTagsOnFetch)
await new Commands.Config(_repo.FullPath)
.Use(log)
.SetAsync($"remote.{_name}.pruneTags", "true");
await new Commands.Fetch(_repo.FullPath, _name, false, false)
.Use(log)
.RunAsync();

View File

@@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Threading.Tasks;
@@ -45,12 +44,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _sshkey, value, true);
}
public bool PruneTagsOnFetch
{
get;
set;
}
public EditRemote(Repository repo, Models.Remote remote)
{
_repo = repo;
@@ -59,11 +52,8 @@ namespace SourceGit.ViewModels
_url = remote.URL;
_useSSH = Models.Remote.IsSSH(remote.URL);
var config = new Commands.Config(repo.FullPath);
if (_useSSH)
_sshkey = config.Get($"remote.{remote.Name}.sshkey");
PruneTagsOnFetch = config.Get($"remote.{remote.Name}.pruneTags").Equals("true", StringComparison.OrdinalIgnoreCase);
_sshkey = new Commands.Config(repo.FullPath).Get($"remote.{remote.Name}.sshkey");
}
public static ValidationResult ValidateRemoteName(string name, ValidationContext ctx)
@@ -131,9 +121,7 @@ namespace SourceGit.ViewModels
if (pushURL != _url)
await new Commands.Remote(_repo.FullPath).SetURLAsync(_name, _url, true);
var config = new Commands.Config(_repo.FullPath);
await config.SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
await config.SetAsync($"remote.{_name}.pruneTags", PruneTagsOnFetch ? "true" : null);
await new Commands.Config(_repo.FullPath).SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
_repo.SetWatcherEnabled(true);
return true;

View File

@@ -12,7 +12,7 @@
Classes="bold"
Text="{DynamicResource Text.Remote.AddTitle}"/>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto,32" ColumnDefinitions="120,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto" ColumnDefinitions="120,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@@ -55,11 +55,6 @@
</TextBox.InnerRightContent>
</TextBox>
</Border>
<CheckBox Grid.Row="3" Grid.Column="1"
Content="{DynamicResource Text.Remote.PruneTagsOnFetch}"
IsChecked="{Binding PruneTagsOnFetch, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Remote.PruneTagsOnFetch.Tip}"/>
</Grid>
</StackPanel>
</UserControl>

View File

@@ -12,7 +12,7 @@
Classes="bold"
Text="{DynamicResource Text.Remote.EditTitle}"/>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto,32" ColumnDefinitions="150,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto" ColumnDefinitions="150,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@@ -55,11 +55,6 @@
</TextBox.InnerRightContent>
</TextBox>
</Border>
<CheckBox Grid.Row="3" Grid.Column="1"
Content="{DynamicResource Text.Remote.PruneTagsOnFetch}"
IsChecked="{Binding PruneTagsOnFetch, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Remote.PruneTagsOnFetch.Tip}"/>
</Grid>
</StackPanel>
</UserControl>