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

Commit 0164af3

Browse files
Merge branch 'master' into enhancements/initialize-view
2 parents a843dca + f441bbd commit 0164af3

File tree

14 files changed

+141
-114
lines changed

14 files changed

+141
-114
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.20.0";
34+
internal const string Version = "0.21.0";
3535
}
3636
}

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,15 @@ private async Task SetupGit()
6464
if (Environment.IsWindows)
6565
{
6666
var credentialHelper = await GitClient.GetConfig("credential.helper", GitConfigSource.Global).StartAwait();
67-
if (string.IsNullOrEmpty(credentialHelper))
67+
68+
if (!string.IsNullOrEmpty(credentialHelper))
69+
{
70+
Logger.Trace("Windows CredentialHelper: {0}", credentialHelper);
71+
}
72+
else
6873
{
74+
Logger.Warning("No Windows CredentialHeloper found: Setting to wincred");
75+
6976
await GitClient.SetConfig("credential.helper", "wincred", GitConfigSource.Global).StartAwait();
7077
}
7178
}

src/GitHub.Api/Authentication/Keychain.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@ public async Task<IKeychainAdapter> Load(UriString host)
6464
logger.Warning("Cannot load host from Credential Manager; removing from cache");
6565
await Clear(host, false);
6666
}
67-
else if (keychainItem.Username != cachedConnection.Username)
68-
{
69-
logger.Warning("Item loaded from credential manager does not match connection cache ; removing from cache");
70-
await Clear(host, false);
71-
}
7267
else
7368
{
74-
logger.Trace($@"Loaded from Credential Manager Host:""{keychainItem.Host}"" Username:""{keychainItem.Username}""");
69+
if (keychainItem.Username != cachedConnection.Username)
70+
{
71+
logger.Warning("Keychain Username: {0} does not match; Hopefully it works", keychainItem.Username);
72+
}
73+
74+
logger.Trace("Loaded from Credential Manager Host:\"{0}\" Username:\"{1}\"", keychainItem.Host, keychainItem.Username);
75+
7576
keychainAdapter.Set(keychainItem);
7677
}
7778

src/GitHub.Api/Git/GitClient.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,30 @@ public async Task<NPath> FindGitInstallation()
103103
if (!String.IsNullOrEmpty(environment.GitExecutablePath))
104104
return environment.GitExecutablePath;
105105

106-
var path = await LookForPortableGit();
106+
NPath path = null;
107+
108+
if (environment.IsWindows)
109+
path = await LookForPortableGit();
110+
107111
if (path == null)
108112
path = await LookForSystemGit();
109113

110-
Logger.Trace("Git Installation folder {0} discovered: '{1}'", path == null ? "not" : "", path);
114+
if (path == null)
115+
{
116+
Logger.Trace("Git Installation not discovered");
117+
}
118+
else
119+
{
120+
Logger.Trace("Git Installation discovered: '{0}'", path);
121+
}
111122

112123
return path;
113124
}
114125

115126
private Task<NPath> LookForPortableGit()
116127
{
128+
Logger.Trace("LookForPortableGit");
129+
117130
var gitHubLocalAppDataPath = environment.UserCachePath;
118131
if (!gitHubLocalAppDataPath.DirectoryExists())
119132
return null;
@@ -134,16 +147,22 @@ private Task<NPath> LookForPortableGit()
134147

135148
private async Task<NPath> LookForSystemGit()
136149
{
150+
Logger.Trace("LookForSystemGit");
151+
137152
NPath path = null;
138153
if (!environment.IsWindows)
139154
{
140155
var p = new NPath("/usr/local/bin/git");
156+
141157
if (p.FileExists())
142158
path = p;
143159
}
144160

145161
if (path == null)
146-
path = await new FindExecTask("git", taskManager.Token).StartAwait();
162+
{
163+
path = await new FindExecTask("git", taskManager.Token)
164+
.Configure(processManager).StartAwait();
165+
}
147166

148167
return path;
149168
}

src/GitHub.Api/Git/GitCredentialManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ private async Task<bool> LoadCredentialHelper()
133133
.Configure(processManager)
134134
.StartAwait();
135135

136+
Logger.Trace("Loaded Credential Helper: {0}", credHelper);
137+
136138
if (credHelper != null)
137139
{
138140
return true;

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,16 @@ public ITask LockFile(string file)
312312
{
313313
var task = GitClient.Lock(file);
314314
HookupHandlers(task);
315-
ListLocks(false);
316-
return task;
315+
316+
return task.Then(ListLocks(false));
317317
}
318318

319319
public ITask UnlockFile(string file, bool force)
320320
{
321321
var task = GitClient.Unlock(file, force);
322322
HookupHandlers(task).Schedule(taskManager);
323-
ListLocks(false);
324-
return task;
323+
324+
return task.Then(ListLocks(false));
325325
}
326326

327327
private void LoadGitUser()

src/GitHub.Api/OutputProcessors/ProcessManager.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,28 @@ public ProcessManager(IEnvironment environment, IProcessEnvironment gitEnvironme
2424

2525
public T Configure<T>(T processTask, bool withInput = false) where T : IProcess
2626
{
27+
NPath executableFileName;
28+
if (processTask.ProcessName != null)
29+
{
30+
executableFileName = processTask.ProcessName.ToNPath();
31+
//logger.Trace("Configuring Task:{0} with Exec:{1}", processTask.GetType().Name, executableFileName);
32+
}
33+
else
34+
{
35+
executableFileName = environment.GitExecutablePath;
36+
//logger.Trace("Configuring Task:{0} with Git", processTask.GetType().Name);
37+
}
38+
2739
return Configure(processTask,
28-
processTask.ProcessName?.ToNPath() ?? environment.GitExecutablePath,
40+
executableFileName,
2941
processTask.ProcessArguments,
3042
environment.RepositoryPath, withInput);
3143
}
3244

3345
public T Configure<T>(T processTask, string executableFileName, string arguments, NPath workingDirectory = null, bool withInput = false)
3446
where T : IProcess
3547
{
48+
//If this null check fails, be sure you called Configure() on your task
3649
Guard.ArgumentNotNull(executableFileName, nameof(executableFileName));
3750

3851
var startInfo = new ProcessStartInfo

src/GitHub.Api/Platform/FindExecTask.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public FindExecTask(string executable, CancellationToken token)
1313
arguments = executable;
1414
}
1515

16+
public override string ProcessName { get { return Name; } }
1617
public override string ProcessArguments { get { return arguments; } }
1718
public override TaskAffinity Affinity { get { return TaskAffinity.Concurrent; } }
1819
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class BranchesView : Subview
5252
[SerializeField] private List<Remote> remotes = new List<Remote>();
5353
[SerializeField] private Vector2 scroll;
5454
[SerializeField] private BranchTreeNode selectedNode;
55-
private List<string> favoritesList;
55+
[SerializeField] private List<string> favoritesList = new List<string>();
5656

5757
public override void InitializeView(IView parent)
5858
{

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public static PopupWindow Open(PopupViewType popupViewType, Action<bool> onClose
4141

4242
popupWindow.ActiveViewType = popupViewType;
4343
popupWindow.titleContent = new GUIContent(popupWindow.ActiveView.Title, Styles.SmallLogo);
44-
45-
popupWindow.InitializeWindow(EntryPoint.ApplicationManager);
44+
popupWindow.OnEnable();
4645
popupWindow.Show();
46+
popupWindow.Refresh();
4747

4848
return popupWindow;
4949
}
@@ -64,7 +64,6 @@ public override void Initialize(IApplicationManager applicationManager)
6464
public override void OnEnable()
6565
{
6666
base.OnEnable();
67-
6867
minSize = maxSize = ActiveView.Size;
6968
ActiveView.OnEnable();
7069
}
@@ -75,6 +74,12 @@ public override void OnDisable()
7574
ActiveView.OnDisable();
7675
}
7776

77+
public override void OnDataUpdate()
78+
{
79+
base.OnDataUpdate();
80+
ActiveView.OnDataUpdate();
81+
}
82+
7883
public override void OnUI()
7984
{
8085
base.OnUI();
@@ -132,7 +137,14 @@ private Subview ActiveView
132137
private PopupViewType ActiveViewType
133138
{
134139
get { return activeViewType; }
135-
set { activeViewType = value; }
140+
set
141+
{
142+
if (activeViewType != value)
143+
{
144+
ActiveView.OnDisable();
145+
activeViewType = value;
146+
}
147+
}
136148
}
137149
}
138150
}

0 commit comments

Comments
 (0)