Skip to content

Commit 58be69f

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 58be69f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
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: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ public List<Models.Remote> Remotes
1313
public bool FetchAllRemotes
1414
{
1515
get => _fetchAllRemotes;
16-
set => SetProperty(ref _fetchAllRemotes, value);
16+
set
17+
{
18+
_repo.Settings.FetchAllRemotes = value;
19+
SetProperty(ref _fetchAllRemotes, value);
20+
}
1721
}
1822

1923
public Models.Remote SelectedRemote
@@ -37,7 +41,8 @@ public bool Force
3741
public Fetch(Repository repo, Models.Remote preferredRemote = null)
3842
{
3943
_repo = repo;
40-
_fetchAllRemotes = preferredRemote == null;
44+
// _fetchAllRemotes = preferredRemote == null;
45+
_fetchAllRemotes = _repo.Settings.FetchAllRemotes;
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)