From cb3727b524fc1564d4c3e0ae1aba6989b2fd6257 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 18 Dec 2024 09:36:25 +0800 Subject: [PATCH] feature: remember `--force` check state in `git fetch` popup (#824) --- src/Models/RepositorySettings.cs | 6 ++++++ src/ViewModels/Fetch.cs | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index 5b3aa331..8fe33556 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -26,6 +26,12 @@ namespace SourceGit.Models set; } = false; + public bool EnableForceOnFetch + { + get; + set; + } = false; + public bool FetchWithoutTags { get; diff --git a/src/ViewModels/Fetch.cs b/src/ViewModels/Fetch.cs index a93304f7..2d907edd 100644 --- a/src/ViewModels/Fetch.cs +++ b/src/ViewModels/Fetch.cs @@ -30,15 +30,14 @@ namespace SourceGit.ViewModels public bool Force { - get; - set; + get => _repo.Settings.EnableForceOnFetch; + set => _repo.Settings.EnableForceOnFetch = value; } public Fetch(Repository repo, Models.Remote preferedRemote = null) { _repo = repo; _fetchAllRemotes = preferedRemote == null; - Force = false; SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0]; View = new Views.Fetch() { DataContext = this }; } @@ -49,7 +48,7 @@ namespace SourceGit.ViewModels var notags = _repo.Settings.FetchWithoutTags; var prune = _repo.Settings.EnablePruneOnFetch; - var force = Force; + var force = _repo.Settings.EnableForceOnFetch; return Task.Run(() => { if (FetchAllRemotes)