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

Commit 8903922

Browse files
Merge pull request #195 from github-for-unity/fixes/remote-url-blank-after-publish
Fixes to populate remote url text field after publish
2 parents 4338edd + 48be91c commit 8903922

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class SettingsView : Subview
6767
private const string DefaultRepositoryRemoteName = "origin";
6868

6969
[NonSerialized] private int newGitIgnoreRulesSelection = -1;
70-
[NonSerialized] private ConfigRemote? activeRemote;
7170

7271
[SerializeField] private string gitName;
7372
[SerializeField] private string gitEmail;
@@ -94,6 +93,8 @@ public override void OnEnable()
9493
{
9594
base.OnEnable();
9695
AttachHandlers(Repository);
96+
97+
remoteHasChanged = true;
9798
}
9899

99100
public override void OnDisable()
@@ -114,8 +115,9 @@ public override void OnRepositoryChanged(IRepository oldRepository)
114115

115116
DetachHandlers(oldRepository);
116117
AttachHandlers(Repository);
117-
activeRemote = Repository.CurrentRemote;
118+
118119
remoteHasChanged = true;
120+
119121
Refresh();
120122
}
121123

@@ -178,7 +180,7 @@ private void MaybeUpdateData()
178180

179181
if (Repository == null)
180182
{
181-
if (cachedUser == null || String.IsNullOrEmpty(cachedUser.Name))
183+
if ((cachedUser == null || String.IsNullOrEmpty(cachedUser.Name)) && GitClient != null)
182184
{
183185
var user = new User();
184186
GitClient.GetConfig("user.name", GitConfigSource.User)
@@ -221,6 +223,7 @@ private void MaybeUpdateData()
221223
if (remoteHasChanged)
222224
{
223225
remoteHasChanged = false;
226+
var activeRemote = Repository.CurrentRemote;
224227
hasRemote = activeRemote.HasValue && !String.IsNullOrEmpty(activeRemote.Value.Url);
225228
if (!hasRemote)
226229
{
@@ -245,7 +248,6 @@ private void ResetToDefaults()
245248

246249
private void Repository_OnActiveRemoteChanged(string remote)
247250
{
248-
activeRemote = Repository.CurrentRemote;
249251
remoteHasChanged = true;
250252
}
251253

0 commit comments

Comments
 (0)