Skip to content

Commit a59600c

Browse files
committed
enhance: supports default remote in Pull if current branch has no upstream (#534)
1 parent d746e35 commit a59600c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ViewModels/Pull.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,18 @@ public Pull(Repository repo, Models.Branch specifiedRemoteBranch)
9595
}
9696
}
9797

98-
_selectedRemote = autoSelectedRemote ?? repo.Remotes[0];
98+
if (autoSelectedRemote == null)
99+
{
100+
var remote = null as Models.Remote;
101+
if (!string.IsNullOrEmpty(_repo.Settings.DefaultRemote))
102+
remote = _repo.Remotes.Find(x => x.Name == _repo.Settings.DefaultRemote);
103+
_selectedRemote = remote ?? _repo.Remotes[0];
104+
}
105+
else
106+
{
107+
_selectedRemote = autoSelectedRemote;
108+
}
109+
99110
PostRemoteSelected();
100111
HasSpecifiedRemoteBranch = false;
101112
}
@@ -132,7 +143,7 @@ public override Task<bool> Sure()
132143
}
133144
}
134145

135-
var rs = false;
146+
bool rs;
136147
if (FetchAllBranches)
137148
{
138149
SetProgressDescription($"Fetching remote: {_selectedRemote.Name}...");

0 commit comments

Comments
 (0)