enhance: supports default remote in Pull if current branch has no upstream (#534)

This commit is contained in:
leo 2024-10-02 15:27:09 +08:00
parent d746e352a7
commit a59600ce18
No known key found for this signature in database

View file

@ -95,7 +95,18 @@ namespace SourceGit.ViewModels
} }
} }
_selectedRemote = autoSelectedRemote ?? repo.Remotes[0]; if (autoSelectedRemote == null)
{
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];
}
else
{
_selectedRemote = autoSelectedRemote;
}
PostRemoteSelected(); PostRemoteSelected();
HasSpecifiedRemoteBranch = false; HasSpecifiedRemoteBranch = false;
} }
@ -132,7 +143,7 @@ namespace SourceGit.ViewModels
} }
} }
var rs = false; bool rs;
if (FetchAllBranches) if (FetchAllBranches)
{ {
SetProgressDescription($"Fetching remote: {_selectedRemote.Name}..."); SetProgressDescription($"Fetching remote: {_selectedRemote.Name}...");