Skip to content

Commit b1147cd

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 7b75fc4 commit b1147cd

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-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+
} = false;
70+
6571
public bool FetchWithoutTags
6672
{
6773
get;

src/ViewModels/Fetch.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ public bool IsFetchAllRemoteVisible
1818

1919
public bool FetchAllRemotes
2020
{
21-
get;
22-
set;
23-
} = false;
21+
get => _fetchAllRemotes;
22+
set
23+
{
24+
_repo.Settings.FetchAllRemotes = value;
25+
SetProperty(ref _fetchAllRemotes, value);
26+
}
27+
}
2428

2529
public Models.Remote SelectedRemote
2630
{
@@ -44,6 +48,7 @@ public Fetch(Repository repo, Models.Remote preferredRemote = null)
4448
{
4549
_repo = repo;
4650
IsFetchAllRemoteVisible = repo.Remotes.Count > 1 && preferredRemote == null;
51+
_fetchAllRemotes = _repo.Settings.FetchAllRemotes;
4752

4853
if (preferredRemote != null)
4954
{
@@ -66,10 +71,11 @@ public override async Task<bool> Sure()
6671

6772
var notags = _repo.Settings.FetchWithoutTags;
6873
var force = _repo.Settings.EnableForceOnFetch;
74+
var all = _repo.Settings.FetchAllRemotes;
6975
var log = _repo.CreateLog("Fetch");
7076
Use(log);
7177

72-
if (FetchAllRemotes)
78+
if (all)
7379
{
7480
foreach (var remote in _repo.Remotes)
7581
await new Commands.Fetch(_repo.FullPath, remote.Name, notags, force)
@@ -98,5 +104,6 @@ public override async Task<bool> Sure()
98104
}
99105

100106
private readonly Repository _repo = null;
107+
private bool _fetchAllRemotes;
101108
}
102109
}

0 commit comments

Comments
 (0)