From 106aaa58a9b032dd075b84e58c8b81b51074bb2c Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 9 Nov 2017 17:25:09 -0500 Subject: [PATCH 1/2] Attempting to fix the issue by adding manual refresh functionality --- src/GitHub.Api/Git/IRepository.cs | 3 +++ src/GitHub.Api/Git/Repository.cs | 24 +++++++++++++++++-- .../Editor/GitHub.Unity/UI/ChangesView.cs | 2 +- .../Editor/GitHub.Unity/UI/HistoryView.cs | 4 ++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/GitHub.Api/Git/IRepository.cs b/src/GitHub.Api/Git/IRepository.cs index 7e2d279fa..8ed108a22 100644 --- a/src/GitHub.Api/Git/IRepository.cs +++ b/src/GitHub.Api/Git/IRepository.cs @@ -19,6 +19,9 @@ public interface IRepository : IEquatable ITask RequestLock(string file); ITask ReleaseLock(string file, bool force); + void RefreshLog(); + void RefreshStatus(); + 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 f4c3359c9..daadaacda 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -81,12 +81,22 @@ public ITask SetupRemote(string remote, string remoteUrl) public ITask CommitAllFiles(string message, string body) { - return repositoryManager.CommitAllFiles(message, body); + return repositoryManager + .CommitAllFiles(message, body) + .Then(() => { + UpdateGitStatus(); + UpdateGitLog(); + }); } public ITask CommitFiles(List files, string message, string body) { - return repositoryManager.CommitFiles(files, message, body); + return repositoryManager + .CommitFiles(files, message, body) + .Then(() => { + UpdateGitStatus(); + UpdateGitLog(); + }); } public ITask Pull() @@ -122,6 +132,16 @@ public ITask ReleaseLock(string file, bool force) .Then(UpdateLocks); } + public void RefreshLog() + { + UpdateGitLog(); + } + + public void RefreshStatus() + { + UpdateGitStatus(); + } + public void CheckLogChangedEvent(CacheUpdateEvent cacheUpdateEvent) { var managedCache = cacheContainer.GitLogCache; diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs index 3434bd075..388ab55fa 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs @@ -43,7 +43,7 @@ public override void OnEnable() if (Repository != null) { Repository.CheckCurrentBranchChangedEvent(lastCurrentBranchChangedEvent); - Repository.CheckStatusChangedEvent(lastStatusChangedEvent); + Repository.RefreshStatus(); } } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs index b8fc37400..434e2e79d 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs @@ -73,8 +73,8 @@ public override void OnEnable() if (Repository != null) { - Repository.CheckLogChangedEvent(lastLogChangedEvent); - Repository.CheckStatusChangedEvent(lastStatusChangedEvent); + Repository.RefreshLog(); + Repository.RefreshStatus(); Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent); } } From 767b9795848364c4adfe95e34601da878ba154a5 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 9 Nov 2017 17:35:35 -0500 Subject: [PATCH 2/2] Forcing an update of branch lists after commit --- src/GitHub.Api/Git/RepositoryManager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GitHub.Api/Git/RepositoryManager.cs b/src/GitHub.Api/Git/RepositoryManager.cs index 0e2300a1a..5f82595a7 100644 --- a/src/GitHub.Api/Git/RepositoryManager.cs +++ b/src/GitHub.Api/Git/RepositoryManager.cs @@ -177,6 +177,7 @@ public ITask CommitAllFiles(string message, string body) add.OnStart += t => IsBusy = true; return add .Then(GitClient.Commit(message, body)) + .Then(UpdateConfigData) .Finally(() => IsBusy = false); } @@ -186,6 +187,7 @@ 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); }