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

@ -100,7 +100,7 @@ namespace SourceGit.ViewModels
{
SetProgressDescription("Fetching from added remote ...");
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
new Commands.Fetch(_repo.FullPath, _name, false, false, false, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, _name, false, false, SetProgressDescription).Exec();
}
CallUIThread(() =>
{

View file

@ -47,7 +47,6 @@ namespace SourceGit.ViewModels
_repo.SetWatcherEnabled(false);
var notags = _repo.Settings.FetchWithoutTags;
var prune = _repo.Settings.EnablePruneOnFetch;
var force = _repo.Settings.EnableForceOnFetch;
return Task.Run(() =>
{
@ -56,13 +55,13 @@ namespace SourceGit.ViewModels
foreach (var remote in _repo.Remotes)
{
SetProgressDescription($"Fetching remote: {remote.Name}");
new Commands.Fetch(_repo.FullPath, remote.Name, notags, prune, force, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, remote.Name, notags, force, SetProgressDescription).Exec();
}
}
else
{
SetProgressDescription($"Fetching remote: {SelectedRemote.Name}");
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, prune, force, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, force, SetProgressDescription).Exec();
}
CallUIThread(() =>

View file

@ -151,7 +151,6 @@ namespace SourceGit.ViewModels
_repo.FullPath,
_selectedRemote.Name,
NoTags,
_repo.Settings.EnablePruneOnFetch,
false,
SetProgressDescription).Exec();
@ -184,7 +183,6 @@ namespace SourceGit.ViewModels
_selectedBranch.Name,
UseRebase,
NoTags,
_repo.Settings.EnablePruneOnFetch,
SetProgressDescription).Exec();
}

View file

@ -2361,7 +2361,7 @@ namespace SourceGit.ViewModels
Dispatcher.UIThread.Invoke(() => IsAutoFetching = true);
foreach (var remote in remotes)
new Commands.Fetch(_fullpath, remote, false, _settings.EnablePruneOnFetch, false, null) { RaiseError = false }.Exec();
new Commands.Fetch(_fullpath, remote, false, false, null) { RaiseError = false }.Exec();
_lastFetchTime = DateTime.Now;
Dispatcher.UIThread.Invoke(() => IsAutoFetching = false);
}

View file

@ -60,12 +60,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _httpProxy, value);
}
public bool EnablePruneOnFetch
{
get => _repo.Settings.EnablePruneOnFetch;
set => _repo.Settings.EnablePruneOnFetch = value;
}
public bool EnableAutoFetch
{
get => _repo.Settings.EnableAutoFetch;