From 115f77f94b14b9fee855b1f7ee6f75af4c5e7644 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 13 Nov 2017 11:07:29 -0500 Subject: [PATCH] Calling UpdateConfigData in BranchView.OnEnable() to refresh BranchList --- src/GitHub.Api/Git/IRepository.cs | 2 +- src/GitHub.Api/Git/Repository.cs | 5 +++++ src/GitHub.Api/Git/RepositoryManager.cs | 8 ++++++-- .../Assets/Editor/GitHub.Unity/UI/BranchesView.cs | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/GitHub.Api/Git/IRepository.cs b/src/GitHub.Api/Git/IRepository.cs index 8ed108a22..e6117dde8 100644 --- a/src/GitHub.Api/Git/IRepository.cs +++ b/src/GitHub.Api/Git/IRepository.cs @@ -21,7 +21,7 @@ public interface IRepository : IEquatable void RefreshLog(); void RefreshStatus(); - + void UpdateConfigData(); void CheckLogChangedEvent(CacheUpdateEvent gitLogCacheUpdateEvent); void CheckStatusChangedEvent(CacheUpdateEvent cacheUpdateEvent); void CheckCurrentBranchChangedEvent(CacheUpdateEvent cacheUpdateEvent); diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index daadaacda..916e98dd9 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -142,6 +142,11 @@ public void RefreshStatus() UpdateGitStatus(); } + public void UpdateConfigData() + { + repositoryManager?.UpdateConfigData(); + } + public void CheckLogChangedEvent(CacheUpdateEvent cacheUpdateEvent) { var managedCache = cacheContainer.GitLogCache; diff --git a/src/GitHub.Api/Git/RepositoryManager.cs b/src/GitHub.Api/Git/RepositoryManager.cs index fa458c184..16632c33b 100644 --- a/src/GitHub.Api/Git/RepositoryManager.cs +++ b/src/GitHub.Api/Git/RepositoryManager.cs @@ -40,6 +40,7 @@ public interface IRepositoryManager : IDisposable ITask LockFile(string file); ITask UnlockFile(string file, bool force); int WaitForEvents(); + void UpdateConfigData(); IGitConfig Config { get; } IGitClient GitClient { get; } @@ -177,7 +178,6 @@ public ITask CommitAllFiles(string message, string body) add.OnStart += t => IsBusy = true; return add .Then(GitClient.Commit(message, body)) - .Then(UpdateConfigData) .Finally(() => IsBusy = false); } @@ -187,7 +187,6 @@ public ITask CommitFiles(List files, string message, string body) add.OnStart += t => IsBusy = true; return add .Then(GitClient.Commit(message, body)) - .Then(UpdateConfigData) .Finally(() => IsBusy = false); } @@ -298,6 +297,11 @@ public ITask UnlockFile(string file, bool force) return HookupHandlers(task); } + public void UpdateConfigData() + { + UpdateConfigData(false); + } + private void LoadGitUser() { GitClient.GetConfigUserAndEmail() diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index bd3b70c7b..1ef7aa7b2 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -68,6 +68,7 @@ public override void OnEnable() if (Repository != null) { Repository.CheckLocalAndRemoteBranchListChangedEvent(lastLocalAndRemoteBranchListChangedEvent); + Repository.UpdateConfigData(); } }