feature: supports to set default remote to push local branches without any tracking remotes (#534)

This commit is contained in:
leo 2024-10-02 15:13:27 +08:00
parent 6d1dfad8a1
commit d746e352a7
No known key found for this signature in database
7 changed files with 66 additions and 10 deletions

View file

@ -137,9 +137,15 @@ namespace SourceGit.ViewModels
}
}
// Set default remote to the first if haven't been set.
// Set default remote to the first if it has not been set.
if (_selectedRemote == null)
_selectedRemote = repo.Remotes[0];
{
var remote = null as Models.Remote;
if (!string.IsNullOrEmpty(_repo.Settings.DefaultRemote))
remote = repo.Remotes.Find(x => x.Name == _repo.Settings.DefaultRemote);
_selectedRemote = remote ?? repo.Remotes[0];
}
// Auto select preferred remote branch.
AutoSelectBranchByRemote();