Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/SettingsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class SettingsView : Subview
private const string DefaultRepositoryRemoteName = "origin";

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

[SerializeField] private string gitName;
[SerializeField] private string gitEmail;
Expand All @@ -94,6 +93,8 @@ public override void OnEnable()
{
base.OnEnable();
AttachHandlers(Repository);

remoteHasChanged = true;
}

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

DetachHandlers(oldRepository);
AttachHandlers(Repository);
activeRemote = Repository.CurrentRemote;

remoteHasChanged = true;

Refresh();
}

Expand Down Expand Up @@ -178,7 +180,7 @@ private void MaybeUpdateData()

if (Repository == null)
{
if (cachedUser == null || String.IsNullOrEmpty(cachedUser.Name))
if ((cachedUser == null || String.IsNullOrEmpty(cachedUser.Name)) && GitClient != null)
{
var user = new User();
GitClient.GetConfig("user.name", GitConfigSource.User)
Expand Down Expand Up @@ -221,6 +223,7 @@ private void MaybeUpdateData()
if (remoteHasChanged)
{
remoteHasChanged = false;
var activeRemote = Repository.CurrentRemote;
hasRemote = activeRemote.HasValue && !String.IsNullOrEmpty(activeRemote.Value.Url);
if (!hasRemote)
{
Expand All @@ -245,7 +248,6 @@ private void ResetToDefaults()

private void Repository_OnActiveRemoteChanged(string remote)
{
activeRemote = Repository.CurrentRemote;
remoteHasChanged = true;
}

Expand Down