Skip to content

Commit ffa1a36

Browse files
committed
enhance: copy remote names before running auto-fetch
Signed-off-by: leo <[email protected]>
1 parent 2919433 commit ffa1a36

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ViewModels/Repository.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,18 +1983,22 @@ private void AutoFetchInBackground(object sender)
19831983

19841984
IsAutoFetching = true;
19851985

1986+
var remotes = new List<string>();
1987+
foreach (var r in _remotes)
1988+
remotes.Add(r.Name);
1989+
19861990
if (_settings.FetchAllRemotes)
19871991
{
1988-
foreach (var remote in _remotes)
1989-
await new Commands.Fetch(_fullpath, remote.Name, false, false) { RaiseError = false }.RunAsync();
1992+
foreach (var remote in remotes)
1993+
await new Commands.Fetch(_fullpath, remote, false, false) { RaiseError = false }.RunAsync();
19901994
}
1991-
else if (_remotes.Count > 0)
1995+
else if (remotes.Count > 0)
19921996
{
19931997
var remote = string.IsNullOrEmpty(_settings.DefaultRemote) ?
1994-
_remotes.Find(x => x.Name.Equals(_settings.DefaultRemote, StringComparison.Ordinal)) :
1995-
_remotes[0];
1998+
remotes.Find(x => x.Equals(_settings.DefaultRemote, StringComparison.Ordinal)) :
1999+
remotes[0];
19962000

1997-
await new Commands.Fetch(_fullpath, remote.Name, false, false) { RaiseError = false }.RunAsync();
2001+
await new Commands.Fetch(_fullpath, remote, false, false) { RaiseError = false }.RunAsync();
19982002
}
19992003

20002004
_lastFetchTime = DateTime.Now;

0 commit comments

Comments
 (0)