Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit f956879

Browse files
authored
Merge pull request #322 from github/fixes/push-pull-buttons
Fix to disable the pull button if there is no remote
2 parents 83b69c8 + 45ba30b commit f956879

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/GitHub.Api/RepositoryManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,15 @@ private void LoadRemotesFromConfig()
519519
return remote;
520520
}
521521

522-
return config.GetRemotes().FirstOrDefault();
522+
using (var remoteEnumerator = config.GetRemotes().GetEnumerator())
523+
{
524+
if (remoteEnumerator.MoveNext())
525+
{
526+
return remoteEnumerator.Current;
527+
}
528+
}
529+
530+
return null;
523531
}
524532

525533
private ConfigBranch? GetActiveBranch()

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void OnEmbeddedGUI()
329329
}
330330

331331
var pushButtonText = statusAhead > 0 ? String.Format(PushButtonCount, statusAhead) : PushButton;
332-
GUI.enabled = statusBehind == 0;
332+
GUI.enabled = currentRemote != null && statusBehind == 0;
333333
var pushClicked = GUILayout.Button(pushButtonText, Styles.HistoryToolbarButtonStyle);
334334
GUI.enabled = true;
335335
if (pushClicked &&

0 commit comments

Comments
 (0)