Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show "None" message in diagnose instead of invalid url #329

Merged
merged 1 commit into from
Oct 4, 2018

Conversation

jeschu1
Copy link
Member

@jeschu1 jeschu1 commented Oct 3, 2018

When a cache server is not set up we shouldn't be showing the invalid default url.

Instead let's show a helpful message to the user.

#289

@jeschu1 jeschu1 requested a review from sanoursa October 3, 2018 15:57
@jeschu1 jeschu1 closed this Oct 3, 2018
@jeschu1 jeschu1 reopened this Oct 3, 2018
@@ -11,9 +11,9 @@ namespace GVFS.Common
public partial class GVFSEnlistment : Enlistment
{
public const string BlobSizesCacheName = "blobSizes";
public const string InvalidRepoUrl = "invalid://repoUrl";
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should make this constant public. The point of it was that it should never leak out of this class.

Right now, I think you're fixing the symptom by checking for this constant before displaying it. But how did the invalid URL leak out of here in the first place? What other code paths might be affected? Rather than special case all uses, I'd like to understand the root cause better.

@@ -53,7 +53,9 @@ protected override void Execute(GVFSEnlistment enlistment)
this.WriteMessage(GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath());
this.WriteMessage(string.Empty);
this.WriteMessage("Enlistment root: " + enlistment.EnlistmentRoot);
this.WriteMessage("Cache Server: " + CacheServerResolver.GetUrlFromConfig(enlistment));
string cacheServer = CacheServerResolver.GetUrlFromConfig(enlistment);
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that GetUrlFromConfig should have returned the origin URL if there was no cache server configured. So this is not just a case of "no cache server". Did we actually somehow create a bogus origin remote? Or is there some other bug that is causing that bad URL to leak out of this method?

If not cache server is present display "None"
@jeschu1 jeschu1 changed the title Show "No Cache Server" message in diagnose instead of invalid url Show "None" message in diagnose instead of invalid url Oct 3, 2018
@@ -90,7 +89,7 @@ public static GVFSEnlistment CreateWithoutRepoUrlFromDirectory(string directory,
return null;
}

return new GVFSEnlistment(enlistmentRoot, InvalidRepoUrl, gitBinRoot, gvfsHooksRoot);
return new GVFSEnlistment(enlistmentRoot, string.Empty, gitBinRoot, gvfsHooksRoot);
Copy link
Member Author

Choose a reason for hiding this comment

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

@sanoursa we discussed sending null in here, however in the base if you send in null it will attempt to look up details for the repository here. We don't want that in this case. Previously there was a bug fix to diagnose explicitly saying don't fail if you can't get origin info.

We could look at other options like sending in a flag rather than the string.Empty. Let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine. Any place where we try to use this as a URL, we will still fail. And your fix in DiagnoseVerb now ensures that we show a good display string.

@jeschu1 jeschu1 closed this Oct 3, 2018
@jeschu1 jeschu1 reopened this Oct 3, 2018
Copy link
Contributor

@sanoursa sanoursa left a comment

Choose a reason for hiding this comment

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

Looks good!

@jeschu1 jeschu1 merged commit bd66019 into microsoft:master Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants