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

Commit b00b4d8

Browse files
authored
Merge branch 'master' into fixes/batching-repository-watcher
2 parents be017b6 + 81d8787 commit b00b4d8

File tree

3 files changed

+45
-60
lines changed

3 files changed

+45
-60
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace GitHub.Unity
77
class Styles
88
{
99
public const float BaseSpacing = 10f,
10+
BrowseButtonWidth = 25f,
1011
BroadModeLimit = 500f,
1112
NarrowModeLimit = 300f,
1213
ModeNotificationDelay = .5f,

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

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ public override void OnDataUpdate()
4848
MaybeUpdateData();
4949
}
5050

51-
public override bool IsBusy
52-
{
53-
get { return isBusy; }
54-
}
55-
5651
public override void OnGUI()
5752
{
5853
// Install path
@@ -73,7 +68,7 @@ public override void OnGUI()
7368
CheckEnteredGitPath();
7469
}
7570

76-
if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(25)))
71+
if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(Styles.BrowseButtonWidth)))
7772
{
7873
GUI.FocusControl(null);
7974

@@ -122,13 +117,14 @@ public override void OnGUI()
122117
newGitExec = gitExec;
123118
CheckEnteredGitPath();
124119

125-
new ProcessTask<NPath>(Manager.CancellationToken, new FirstLineIsPathOutputProcessor())
126-
.Configure(Manager.ProcessManager, Environment.IsWindows ? "where" : "which", "git")
127-
.FinallyInUI((success, ex, path) =>
128-
{
120+
new FindExecTask("git", Manager.CancellationToken)
121+
.Configure(Manager.ProcessManager)
122+
.FinallyInUI((success, ex, path) => {
129123
if (success)
130124
{
131125
Logger.Trace("FindGit Path:{0}", path);
126+
newGitExec = path;
127+
CheckEnteredGitPath();
132128
}
133129
else
134130
{
@@ -142,12 +138,6 @@ public override void OnGUI()
142138
}
143139
}
144140

145-
if (success)
146-
{
147-
newGitExec = path;
148-
CheckEnteredGitPath();
149-
}
150-
151141
isBusy = false;
152142
}).Start();
153143
}
@@ -179,30 +169,27 @@ private void MaybeUpdateData()
179169
{
180170
if (gitExecHasChanged)
181171
{
182-
if (Environment != null)
172+
if (gitExecExtension == null)
183173
{
184-
if (gitExecExtension == null)
185-
{
186-
gitExecExtension = Environment.ExecutableExtension;
174+
gitExecExtension = Environment.ExecutableExtension;
187175

188-
if (Environment.IsWindows)
189-
{
190-
gitExecExtension = gitExecExtension.TrimStart('.');
191-
}
176+
if (Environment.IsWindows)
177+
{
178+
gitExecExtension = gitExecExtension.TrimStart('.');
192179
}
180+
}
193181

194-
if (Environment.GitExecutablePath != null)
195-
{
196-
newGitExec = gitExec = Environment.GitExecutablePath.ToString();
197-
gitExecParent = Environment.GitExecutablePath.Parent.ToString();
182+
if (Environment.GitExecutablePath != null)
183+
{
184+
newGitExec = gitExec = Environment.GitExecutablePath.ToString();
185+
gitExecParent = Environment.GitExecutablePath.Parent.ToString();
198186

199-
CheckEnteredGitPath();
200-
}
187+
CheckEnteredGitPath();
188+
}
201189

202-
if (gitExecParent == null)
203-
{
204-
gitExecParent = Environment.GitInstallPath;
205-
}
190+
if (gitExecParent == null)
191+
{
192+
gitExecParent = Environment.GitInstallPath;
206193
}
207194

208195
gitExecHasChanged = false;
@@ -233,25 +220,20 @@ private void ValidateAndSetGitInstallPath(string value)
233220
{
234221
Logger.Trace(ErrorGettingSoftwareVersionMessage);
235222
gitVersionErrorMessage = ErrorGettingSoftwareVersionMessage;
236-
237-
isBusy = false;
238-
239-
return;
240223
}
241-
242-
if (!result.IsValid)
224+
else if (!result.IsValid)
243225
{
244-
Logger.Warning("Software versions do not meet minimums Git:{0} (Minimum:{1}) GitLfs:{2} (Minimum:{3})",
245-
result.GitVersion,
246-
Constants.MinimumGitVersion,
247-
result.GitLfsVersion,
226+
Logger.Warning(
227+
"Software versions do not meet minimums Git:{0} (Minimum:{1}) GitLfs:{2} (Minimum:{3})",
228+
result.GitVersion, Constants.MinimumGitVersion, result.GitLfsVersion,
248229
Constants.MinimumGitLfsVersion);
249230

250231
var errorMessageStringBuilder = new StringBuilder();
251232

252233
if (result.GitVersion < Constants.MinimumGitVersion)
253234
{
254-
errorMessageStringBuilder.AppendFormat(ErrorMinimumGitVersionMessageFormat, result.GitVersion, Constants.MinimumGitVersion);
235+
errorMessageStringBuilder.AppendFormat(ErrorMinimumGitVersionMessageFormat,
236+
result.GitVersion, Constants.MinimumGitVersion);
255237
}
256238

257239
if (result.GitLfsVersion < Constants.MinimumGitLfsVersion)
@@ -261,26 +243,32 @@ private void ValidateAndSetGitInstallPath(string value)
261243
errorMessageStringBuilder.Append(Environment.NewLine);
262244
}
263245

264-
errorMessageStringBuilder.AppendFormat(ErrorMinimumGitLfsVersionMessageFormat, result.GitLfsVersion, Constants.MinimumGitLfsVersion);
246+
errorMessageStringBuilder.AppendFormat(ErrorMinimumGitLfsVersionMessageFormat,
247+
result.GitLfsVersion, Constants.MinimumGitLfsVersion);
265248
}
266249

267250
gitVersionErrorMessage = errorMessageStringBuilder.ToString();
268-
269-
isBusy = false;
270-
return;
271251
}
252+
else
253+
{
254+
Logger.Trace("Software versions meet minimums Git:{0} GitLfs:{1}",
255+
result.GitVersion,
256+
result.GitLfsVersion);
272257

273-
Logger.Trace("Software versions meet minimums Git:{0} GitLfs:{1}",
274-
result.GitVersion,
275-
result.GitLfsVersion);
258+
Manager.SystemSettings.Set(Constants.GitInstallPathKey, value);
259+
Environment.GitExecutablePath = value.ToNPath();
276260

277-
Manager.SystemSettings.Set(Constants.GitInstallPathKey, value);
278-
Environment.GitExecutablePath = value.ToNPath();
261+
gitExecHasChanged = true;
262+
}
279263

280-
gitExecHasChanged = true;
281264
isBusy = false;
282265

283266
}).Start();
284267
}
268+
269+
public override bool IsBusy
270+
{
271+
get { return isBusy; }
272+
}
285273
}
286274
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ public override void OnDisable()
8585
public override void OnDataUpdate()
8686
{
8787
base.OnDataUpdate();
88-
89-
if (gitPathView != null)
90-
{
91-
gitPathView.OnDataUpdate();
92-
}
88+
gitPathView.OnDataUpdate();
9389
MaybeUpdateData();
9490
}
9591

0 commit comments

Comments
 (0)