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

Commit b069134

Browse files
authored
Merge branch 'master' into fixes/publish-view-loading
2 parents f1b5d7e + acc6efc commit b069134

File tree

9 files changed

+67
-12
lines changed

9 files changed

+67
-12
lines changed

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/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/ProjectWindowInterface.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class ProjectWindowInterface : AssetPostprocessor
2222

2323
public static void Initialize(IRepository repo)
2424
{
25+
Logger.Trace("Initialize HasRepository:{0}", repo != null);
26+
2527
EditorApplication.projectWindowItemOnGUI -= OnProjectWindowItemGUI;
2628
EditorApplication.projectWindowItemOnGUI += OnProjectWindowItemGUI;
2729
initialized = true;
@@ -149,7 +151,9 @@ private static void Refresh()
149151
private static void RunLocksUpdateOnMainThread(IEnumerable<GitLock> update)
150152
{
151153
new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnLocksUpdate(update))
152-
.ScheduleUI(EntryPoint.ApplicationManager.TaskManager);
154+
{
155+
Affinity = TaskAffinity.UI
156+
}.Start();
153157
}
154158

155159
private static void OnLocksUpdate(IEnumerable<GitLock> update)
@@ -169,11 +173,16 @@ private static void OnLocksUpdate(IEnumerable<GitLock> update)
169173
var g = AssetDatabase.AssetPathToGUID(assetPath);
170174
guidsLocks.Add(g);
171175
}
176+
177+
EditorApplication.RepaintProjectWindow();
172178
}
173179

174180
private static void RunStatusUpdateOnMainThread(GitStatus update)
175181
{
176-
EntryPoint.ApplicationManager.TaskManager.ScheduleUI(new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnStatusUpdate(update)));
182+
new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnStatusUpdate(update))
183+
{
184+
Affinity = TaskAffinity.UI
185+
}.Start();
177186
}
178187

179188
private static void OnStatusUpdate(GitStatus update)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,13 @@ public override void OnGUI()
226226

227227
var organization = owners[selectedOwner] == username ? null : owners[selectedOwner];
228228

229+
var cleanRepoDescription = repoDescription.Trim();
230+
cleanRepoDescription = cleanRepoDescription == string.Empty ? null : cleanRepoDescription;
231+
229232
Client.CreateRepository(new NewRepository(repoName)
230233
{
231234
Private = togglePrivate,
235+
Description = cleanRepoDescription
232236
}, (repository, ex) =>
233237
{
234238
Logger.Trace("Create Repository Callback");

0 commit comments

Comments
 (0)