refactor: disable --all by default while fetching (#1647)

- If there's only one remote or we have selected the remote to fetch changes from, do not show `Fetch all remotes` option
- Disable `--all` by default

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-08-04 18:22:25 +08:00
parent a4306fe6e3
commit e9bc7fc5be
3 changed files with 21 additions and 9 deletions

View File

@@ -10,11 +10,17 @@ namespace SourceGit.ViewModels
get => _repo.Remotes;
}
public bool IsFetchAllRemoteVisible
{
get;
private set;
} = true;
public bool FetchAllRemotes
{
get => _fetchAllRemotes;
set => SetProperty(ref _fetchAllRemotes, value);
}
get;
set;
} = false;
public Models.Remote SelectedRemote
{
@@ -37,7 +43,7 @@ namespace SourceGit.ViewModels
public Fetch(Repository repo, Models.Remote preferredRemote = null)
{
_repo = repo;
_fetchAllRemotes = preferredRemote == null;
IsFetchAllRemoteVisible = repo.Remotes.Count > 1 && preferredRemote == null;
if (preferredRemote != null)
{
@@ -92,6 +98,5 @@ namespace SourceGit.ViewModels
}
private readonly Repository _repo = null;
private bool _fetchAllRemotes;
}
}