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

Commit 83ddb4b

Browse files
Merge branch 'master' into enhancements/branches-view-rollup
2 parents 1d3bdf1 + d7cae00 commit 83ddb4b

File tree

5 files changed

+124
-93
lines changed

5 files changed

+124
-93
lines changed

common/SolutionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
namespace System
3232
{
3333
internal static class AssemblyVersionInformation {
34-
internal const string Version = "0.23.0";
34+
internal const string Version = "0.24.0";
3535
}
3636
}

src/GitHub.Api/Git/GitRemote.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public enum GitRemoteFunction
1414
[Serializable]
1515
public struct GitRemote
1616
{
17-
public static GitRemote Default = new GitRemote();
17+
public static GitRemote Default = new GitRemote(String.Empty, String.Empty, String.Empty, GitRemoteFunction.Unknown, string.Empty, string.Empty, string.Empty);
1818

1919
public string name;
2020
public string url;

src/GitHub.Api/Git/Repository.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void Initialize(IRepositoryManager initRepositoryManager)
5050
repositoryManager.CurrentBranchUpdated += RepositoryManagerOnCurrentBranchUpdated;
5151
repositoryManager.GitStatusUpdated += RepositoryManagerOnGitStatusUpdated;
5252
repositoryManager.GitLogUpdated += RepositoryManagerOnGitLogUpdated;
53+
repositoryManager.GitLocksUpdated += RepositoryManagerOnGitLocksUpdated;
5354
repositoryManager.LocalBranchesUpdated += RepositoryManagerOnLocalBranchesUpdated;
5455
repositoryManager.RemoteBranchesUpdated += RepositoryManagerOnRemoteBranchesUpdated;
5556
}
@@ -267,7 +268,7 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
267268
break;
268269

269270
case CacheType.GitLocksCache:
270-
repositoryManager?.UpdateLocks();
271+
UpdateLocks();
271272
break;
272273

273274
case CacheType.GitUserCache:
@@ -353,18 +354,18 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
353354
new ActionTask(CancellationToken.None, () => {
354355
if (!Nullable.Equals(CurrentConfigBranch, branch))
355356
{
356-
var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
357+
var currentBranch = branch != null ? (GitBranch?)GetLocalGitBranch(branch.Value) : null;
357358

358-
CurrentConfigBranch = branch;
359-
CurrentBranch = currentBranch;
360-
UpdateLocalBranches();
359+
CurrentConfigBranch = branch;
360+
CurrentBranch = currentBranch;
361+
UpdateLocalBranches();
361362
}
362363

363364
if (!Nullable.Equals(CurrentConfigRemote, remote))
364365
{
365-
CurrentConfigRemote = remote;
366-
CurrentRemote = GetGitRemote(remote.Value);
367-
ClearRepositoryInfo();
366+
CurrentConfigRemote = remote;
367+
CurrentRemote = remote.HasValue ? (GitRemote?)GetGitRemote(remote.Value) : null;
368+
ClearRepositoryInfo();
368369
}
369370
}) { Affinity = TaskAffinity.UI }.Start();
370371
}
@@ -383,6 +384,14 @@ private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
383384
}) { Affinity = TaskAffinity.UI }.Start();
384385
}
385386

387+
private void RepositoryManagerOnGitLocksUpdated(List<GitLock> gitLocks)
388+
{
389+
new ActionTask(CancellationToken.None, () => {
390+
CurrentLocks = gitLocks;
391+
})
392+
{ Affinity = TaskAffinity.UI }.Start();
393+
}
394+
386395
private void RepositoryManagerOnRemoteBranchesUpdated(Dictionary<string, ConfigRemote> remotes,
387396
Dictionary<string, Dictionary<string, ConfigBranch>> branches)
388397
{
@@ -401,6 +410,14 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
401410
}) { Affinity = TaskAffinity.UI }.Start();
402411
}
403412

413+
private void UpdateLocks()
414+
{
415+
if (CurrentRemote.HasValue)
416+
{
417+
repositoryManager?.UpdateLocks();
418+
}
419+
}
420+
404421
private void UpdateLocalBranches()
405422
{
406423
LocalBranches = LocalConfigBranches.Values.Select(GetLocalGitBranch).ToArray();

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,25 +209,13 @@ public ITask RemoteAdd(string remote, string url)
209209
{
210210
var task = GitClient.RemoteAdd(remote, url);
211211
task = HookupHandlers(task, true, false);
212-
if (!platform.Environment.IsWindows)
213-
{
214-
task.Then(_ => {
215-
UpdateConfigData(true);
216-
});
217-
}
218212
return task;
219213
}
220214

221215
public ITask RemoteRemove(string remote)
222216
{
223217
var task = GitClient.RemoteRemove(remote);
224218
task = HookupHandlers(task, true, false);
225-
if (!platform.Environment.IsWindows)
226-
{
227-
task.Then(_ => {
228-
UpdateConfigData(true);
229-
});
230-
}
231219
return task;
232220
}
233221

@@ -258,13 +246,13 @@ public ITask CreateBranch(string branch, string baseBranch)
258246
public ITask LockFile(string file)
259247
{
260248
var task = GitClient.Lock(file);
261-
return HookupHandlers(task, true, false);
249+
return HookupHandlers(task, true, false).Then(UpdateLocks);
262250
}
263251

264252
public ITask UnlockFile(string file, bool force)
265253
{
266254
var task = GitClient.Unlock(file, force);
267-
return HookupHandlers(task, true, false);
255+
return HookupHandlers(task, true, false).Then(UpdateLocks);
268256
}
269257

270258
public void UpdateGitLog()
@@ -360,6 +348,7 @@ private void UpdateHead()
360348
var head = repositoryPaths.DotGitHead.ReadAllLines().FirstOrDefault();
361349
Logger.Trace("UpdateHead: {0}", head ?? "[NULL]");
362350
UpdateCurrentBranchAndRemote(head);
351+
UpdateGitLog();
363352
}
364353

365354
private void UpdateCurrentBranchAndRemote(string head)

0 commit comments

Comments
 (0)