From 1aaf32909f91885a2b3f13b0607a8f789f1411c2 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 11:01:26 -0500 Subject: [PATCH 1/2] Changing UpdateRepositoryInfo to ClearRepositoryInfo --- src/GitHub.Api/Git/Repository.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index f4c3359c9..042979293 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -417,7 +417,7 @@ private void RepositoryManager_OnCurrentBranchAndRemoteUpdated(ConfigBranch? bra { CurrentConfigRemote = remote; CurrentRemote = GetGitRemote(remote.Value); - UpdateRepositoryInfo(); + ClearRepositoryInfo(); } }) { Affinity = TaskAffinity.UI }.Start(); } @@ -460,20 +460,10 @@ private void UpdateLocalBranches() LocalBranches = LocalConfigBranches.Values.Select(GetLocalGitBranch).ToArray(); } - private void UpdateRepositoryInfo() + private void ClearRepositoryInfo() { - if (CurrentRemote.HasValue) - { - CloneUrl = new UriString(CurrentRemote.Value.Url); - Name = CloneUrl.RepositoryName; - Logger.Trace("CloneUrl: {0}", CloneUrl.ToString()); - } - else - { - CloneUrl = null; - Name = LocalPath.FileName; - Logger.Trace("CloneUrl: [NULL]"); - } + CloneUrl = new UriString(CurrentRemote.Value.Url); + Name = CloneUrl.RepositoryName; } private void RepositoryManager_OnLocalBranchRemoved(string name) From 88c114e5ac64496dca8b8383905192aaed143f81 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 14 Nov 2017 14:21:35 -0500 Subject: [PATCH 2/2] CloneUrl and Name can be set to null because the property getter will lazily load the data --- src/GitHub.Api/Git/Repository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index 042979293..39a0754f0 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -462,8 +462,8 @@ private void UpdateLocalBranches() private void ClearRepositoryInfo() { - CloneUrl = new UriString(CurrentRemote.Value.Url); - Name = CloneUrl.RepositoryName; + CloneUrl = null; + Name = null; } private void RepositoryManager_OnLocalBranchRemoved(string name)