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

Commit 85e8d7c

Browse files
authored
Merge pull request #428 from github-for-unity/fixes/refresh-status-and-log-patch
Refresh status, log and branch list patches
2 parents e1f42ce + 88469f6 commit 85e8d7c

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

src/GitHub.Api/Git/IRepository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public interface IRepository : IEquatable<IRepository>
1919
ITask RequestLock(string file);
2020
ITask ReleaseLock(string file, bool force);
2121

22+
void RefreshLog();
23+
void RefreshStatus();
24+
2225
void CheckLogChangedEvent(CacheUpdateEvent gitLogCacheUpdateEvent);
2326
void CheckStatusChangedEvent(CacheUpdateEvent cacheUpdateEvent);
2427
void CheckCurrentBranchChangedEvent(CacheUpdateEvent cacheUpdateEvent);

src/GitHub.Api/Git/Repository.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,22 @@ public ITask SetupRemote(string remote, string remoteUrl)
8181

8282
public ITask CommitAllFiles(string message, string body)
8383
{
84-
return repositoryManager.CommitAllFiles(message, body);
84+
return repositoryManager
85+
.CommitAllFiles(message, body)
86+
.Then(() => {
87+
UpdateGitStatus();
88+
UpdateGitLog();
89+
});
8590
}
8691

8792
public ITask CommitFiles(List<string> files, string message, string body)
8893
{
89-
return repositoryManager.CommitFiles(files, message, body);
94+
return repositoryManager
95+
.CommitFiles(files, message, body)
96+
.Then(() => {
97+
UpdateGitStatus();
98+
UpdateGitLog();
99+
});
90100
}
91101

92102
public ITask Pull()
@@ -122,6 +132,16 @@ public ITask ReleaseLock(string file, bool force)
122132
.Then(UpdateLocks);
123133
}
124134

135+
public void RefreshLog()
136+
{
137+
UpdateGitLog();
138+
}
139+
140+
public void RefreshStatus()
141+
{
142+
UpdateGitStatus();
143+
}
144+
125145
public void CheckLogChangedEvent(CacheUpdateEvent cacheUpdateEvent)
126146
{
127147
var managedCache = cacheContainer.GitLogCache;

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public ITask CommitAllFiles(string message, string body)
177177
add.OnStart += t => IsBusy = true;
178178
return add
179179
.Then(GitClient.Commit(message, body))
180+
.Then(UpdateConfigData)
180181
.Finally(() => IsBusy = false);
181182
}
182183

@@ -186,6 +187,7 @@ public ITask CommitFiles(List<string> files, string message, string body)
186187
add.OnStart += t => IsBusy = true;
187188
return add
188189
.Then(GitClient.Commit(message, body))
190+
.Then(UpdateConfigData)
189191
.Finally(() => IsBusy = false);
190192
}
191193

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public override void OnEnable()
4343
if (Repository != null)
4444
{
4545
Repository.CheckCurrentBranchChangedEvent(lastCurrentBranchChangedEvent);
46-
Repository.CheckStatusChangedEvent(lastStatusChangedEvent);
46+
Repository.RefreshStatus();
4747
}
4848
}
4949

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/HistoryView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public override void OnEnable()
7373

7474
if (Repository != null)
7575
{
76-
Repository.CheckLogChangedEvent(lastLogChangedEvent);
77-
Repository.CheckStatusChangedEvent(lastStatusChangedEvent);
76+
Repository.RefreshLog();
77+
Repository.RefreshStatus();
7878
Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
7979
}
8080
}

0 commit comments

Comments
 (0)