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

Conversation

@StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Aug 15, 2017

Fixes #185

The problem here was due to the use of activeRemote in SettingsView.

When a user is publishing, they are looking at the HistoryView. Which means the SettingsView is disabled, and when a remote is added the event handler SettingsView.OnRepositoryChanged will not run and won't update activeRemote with the new value.

I removed activeRemote and switched it to Repository.CurrentRemote.

I also fixed two errors in the SettingsView that would appear in the user log.

.FinallyInUI((success, ex) =>
{
if (success && !String.IsNullOrEmpty(user.Name))
if(GitClient != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm why is GitClient null here? is the view racing the EntryPoint initialize code?
Also, spaaaaaaaaace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if should be with the condition above:

if ((cachedUser == null || String.IsNullOrEmpty(cachedUser.Name)) && GitClient != null)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitClient was null for me when I rebuilt code with Unity running. I then figured it was possible during a domain reload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know which space we are referring to. 🙈

gitEmail = Repository != null ? Repository.User.Email : String.Empty;
repositoryRemoteName = DefaultRepositoryRemoteName;
repositoryRemoteUrl = string.Empty;
newRepositoryRemoteUrl = repositoryRemoteUrl = string.Empty;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't being called anywhere, let's nuke it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newRepositoryRemoteUrl and repositoryRemoteUrl are both used..

newRepositoryRemoteUrl = EditorGUILayout.TextField(GitRepositoryRemoteLabel + ": " + repositoryRemoteName, newRepositoryRemoteUrl);
var needsSaving = newRepositoryRemoteUrl != repositoryRemoteUrl && !String.IsNullOrEmpty(newRepositoryRemoteUrl);

.FinallyInUI((success, ex) =>
{
if (success && !String.IsNullOrEmpty(user.Name))
if(GitClient != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if should be with the condition above:

if ((cachedUser == null || String.IsNullOrEmpty(cachedUser.Name)) && GitClient != null)

@shana
Copy link
Member

shana commented Aug 16, 2017

If I'm reading this correctly, none of these changes (except GitClient null check) are needed, and instead we should be setting remoteHasChanged = true in OnEnable so it refreshes the data on the next pass.

AttachHandlers(Repository);

activeRemote = Repository != null ? Repository.CurrentRemote : null;
remoteHasChanged = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting remoteHasChanged is not enough. We need to update activeRemote at some point.
Part of my thinking was that activeRemote was only read from here..

hasRemote = activeRemote.HasValue && !String.IsNullOrEmpty(activeRemote.Value.Url);
if (!hasRemote)
{
repositoryRemoteName = DefaultRepositoryRemoteName;
newRepositoryRemoteUrl = repositoryRemoteUrl = string.Empty;
}
else
{
repositoryRemoteName = activeRemote.Value.Name;
newRepositoryRemoteUrl = repositoryRemoteUrl = activeRemote.Value.Url;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right, there's no point in having the field if it's only ever touched here, and it shouldn't be touched anywhere else anyway

@StanleyGoldman StanleyGoldman force-pushed the fixes/remote-url-blank-after-publish branch from a9ee787 to 48be91c Compare August 16, 2017 16:25
@StanleyGoldman StanleyGoldman merged commit 8903922 into master Aug 16, 2017
@StanleyGoldman StanleyGoldman deleted the fixes/remote-url-blank-after-publish branch August 16, 2017 16:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote URL blank after publish

3 participants