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

Commit

Permalink
Merge pull request #428 from github-for-unity/fixes/refresh-status-an…
Browse files Browse the repository at this point in the history
…d-log-patch

Refresh status, log and branch list patches
  • Loading branch information
shana authored Nov 10, 2017
2 parents e1f42ce + 88469f6 commit 85e8d7c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/GitHub.Api/Git/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public interface IRepository : IEquatable<IRepository>
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);
Expand Down
24 changes: 22 additions & 2 deletions src/GitHub.Api/Git/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> files, string message, string body)
{
return repositoryManager.CommitFiles(files, message, body);
return repositoryManager
.CommitFiles(files, message, body)
.Then(() => {
UpdateGitStatus();
UpdateGitLog();
});
}

public ITask Pull()
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/GitHub.Api/Git/RepositoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public override void OnEnable()
if (Repository != null)
{
Repository.CheckCurrentBranchChangedEvent(lastCurrentBranchChangedEvent);
Repository.CheckStatusChangedEvent(lastStatusChangedEvent);
Repository.RefreshStatus();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public override void OnEnable()

if (Repository != null)
{
Repository.CheckLogChangedEvent(lastLogChangedEvent);
Repository.CheckStatusChangedEvent(lastStatusChangedEvent);
Repository.RefreshLog();
Repository.RefreshStatus();
Repository.CheckCurrentRemoteChangedEvent(lastCurrentRemoteChangedEvent);
}
}
Expand Down

0 comments on commit 85e8d7c

Please sign in to comment.