mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
refactor: rewrite branch auto-select after remote changed while pulling (#342)
This commit is contained in:
parent
f98423b4c7
commit
3a54471ea5
1 changed files with 16 additions and 17 deletions
|
@ -182,30 +182,29 @@ namespace SourceGit.ViewModels
|
|||
RemoteBranches = branches;
|
||||
|
||||
var autoSelectedBranch = false;
|
||||
if (!string.IsNullOrEmpty(_current.Upstream))
|
||||
if (!string.IsNullOrEmpty(_current.Upstream) &&
|
||||
_current.Upstream.StartsWith($"refs/remotes/{remoteName}/", System.StringComparison.Ordinal))
|
||||
{
|
||||
if (_current.Upstream.StartsWith($"refs/remotes/{remoteName}/", System.StringComparison.Ordinal))
|
||||
foreach (var branch in branches)
|
||||
{
|
||||
foreach (var branch in branches)
|
||||
if (_current.Upstream == branch.FullName)
|
||||
{
|
||||
if (_current.Upstream == branch.FullName)
|
||||
{
|
||||
SelectedBranch = branch;
|
||||
autoSelectedBranch = true;
|
||||
break;
|
||||
}
|
||||
SelectedBranch = branch;
|
||||
autoSelectedBranch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
if (!autoSelectedBranch)
|
||||
{
|
||||
foreach (var branch in branches)
|
||||
{
|
||||
foreach (var branch in branches)
|
||||
if (_current.Name == branch.Name)
|
||||
{
|
||||
if (_current.Name == branch.Name)
|
||||
{
|
||||
SelectedBranch = branch;
|
||||
autoSelectedBranch = true;
|
||||
break;
|
||||
}
|
||||
SelectedBranch = branch;
|
||||
autoSelectedBranch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue