Skip to content

Commit 9e0cb35

Browse files
committed
feat: remember fetch all remotes property(fixes #1647)
- Add a new property to enable fetching all remotes by default. - Refactor fetch logic to use repository settings directly instead of local properties.
1 parent 7d09af1 commit 9e0cb35

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/Models/RepositorySettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public bool EnableForceOnFetch
6262
set;
6363
} = false;
6464

65+
public bool FetchAllRemotes
66+
{
67+
get;
68+
set;
69+
} = true;
70+
6571
public bool FetchWithoutTags
6672
{
6773
get;

src/ViewModels/Fetch.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ public List<Models.Remote> Remotes
1212

1313
public bool FetchAllRemotes
1414
{
15-
get => _fetchAllRemotes;
16-
set => SetProperty(ref _fetchAllRemotes, value);
15+
get => _repo.Settings.FetchAllRemotes;
16+
set
17+
{
18+
_repo.Settings.FetchAllRemotes = value;
19+
// Thread.Sleep(100);
20+
SetProperty(ref _fetchAllRemotes, value);
21+
}
1722
}
1823

1924
public Models.Remote SelectedRemote
@@ -37,7 +42,7 @@ public bool Force
3742
public Fetch(Repository repo, Models.Remote preferredRemote = null)
3843
{
3944
_repo = repo;
40-
_fetchAllRemotes = preferredRemote == null;
45+
// _fetchAllRemotes = preferredRemote == null;
4146

4247
if (preferredRemote != null)
4348
{
@@ -60,10 +65,11 @@ public override async Task<bool> Sure()
6065

6166
var notags = _repo.Settings.FetchWithoutTags;
6267
var force = _repo.Settings.EnableForceOnFetch;
68+
var all = _repo.Settings.FetchAllRemotes;
6369
var log = _repo.CreateLog("Fetch");
6470
Use(log);
6571

66-
if (FetchAllRemotes)
72+
if (all)
6773
{
6874
foreach (var remote in _repo.Remotes)
6975
await new Commands.Fetch(_repo.FullPath, remote.Name, notags, force)

0 commit comments

Comments
 (0)