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

Commit 0ce2a7c

Browse files
Merge branch 'master' into fixes/reset-to-bundled
2 parents a18623a + e04f587 commit 0ce2a7c

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GitPathView : Subview
1212
private const string PathToGit = "Path to Git";
1313
private const string PathToGitLfs = "Path to Git LFS";
1414
private const string GitPathSaveButton = "Save";
15-
private const string UseInternalGitButton = "Use bundled git";
15+
private const string SetToBundledGitButton = "Set to bundled git";
1616
private const string FindSystemGitButton = "Find system git";
1717
private const string BrowseButton = "...";
1818
private const string GitInstallBrowseTitle = "Select executable";
@@ -96,7 +96,7 @@ public override void OnGUI()
9696
}
9797
if (EditorGUI.EndChangeCheck())
9898
{
99-
changingManually = true;
99+
changingManually = gitPath != installationState.GitExecutablePath || gitLfsPath != installationState.GitLfsExecutablePath;
100100
}
101101
}
102102
GUILayout.EndHorizontal();
@@ -123,7 +123,7 @@ public override void OnGUI()
123123
}
124124
if (EditorGUI.EndChangeCheck())
125125
{
126-
changingManually = true;
126+
changingManually = gitPath != installationState.GitExecutablePath || gitLfsPath != installationState.GitLfsExecutablePath;;
127127
errorMessage = "";
128128
}
129129
}
@@ -147,18 +147,26 @@ public override void OnGUI()
147147
}
148148
EditorGUI.EndDisabledGroup();
149149

150-
if (GUILayout.Button(UseInternalGitButton, GUILayout.ExpandWidth(false)))
150+
// disable the button if the paths are already pointing to the bundled git
151+
// both on windows, only lfs on mac
152+
EditorGUI.BeginDisabledGroup(
153+
(!Environment.IsWindows || gitPath == installDetails.GitExecutablePath) &&
154+
gitLfsPath == installDetails.GitLfsExecutablePath);
151155
{
152-
GUI.FocusControl(null);
156+
if (GUILayout.Button(SetToBundledGitButton, GUILayout.ExpandWidth(false)))
157+
{
158+
GUI.FocusControl(null);
153159

154-
if (Environment.IsWindows)
155-
gitPath = installDetails.GitExecutablePath;
156-
gitLfsPath = installDetails.GitLfsExecutablePath;
157-
resetToBundled = true;
158-
resetToSystem = false;
159-
changingManually = false;
160-
errorMessage = "";
160+
if (Environment.IsWindows)
161+
gitPath = installDetails.GitExecutablePath;
162+
gitLfsPath = installDetails.GitLfsExecutablePath;
163+
resetToBundled = gitPath != installationState.GitExecutablePath || gitLfsPath != installationState.GitLfsExecutablePath;
164+
resetToSystem = false;
165+
changingManually = false;
166+
errorMessage = "";
167+
}
161168
}
169+
EditorGUI.EndDisabledGroup();
162170

163171
//Find button - for attempting to locate a new install
164172
if (GUILayout.Button(FindSystemGitButton, GUILayout.ExpandWidth(false)))
@@ -189,7 +197,7 @@ public override void OnGUI()
189197
}
190198
isBusy = false;
191199
resetToBundled = false;
192-
resetToSystem = true;
200+
resetToSystem = gitPath != installationState.GitExecutablePath || gitLfsPath != installationState.GitLfsExecutablePath;
193201
changingManually = false;
194202
errorMessage = "";
195203
Redraw();

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ class Window : BaseWindow
2222
private const string Window_RepoUrlTooltip = "Url of the {0} remote";
2323
private const string Window_RepoNoUrlTooltip = "Add a remote in the Settings tab";
2424
private const string Window_RepoBranchTooltip = "Active branch";
25-
private const float SpinnerAnimationDuration = 4f;
2625

2726
[NonSerialized] private double notificationClearTime = -1;
2827
[NonSerialized] private double timeSinceLastRotation = -1f;
2928
[NonSerialized] private bool currentBranchAndRemoteHasUpdate;
30-
[NonSerialized] private bool gitExecutableIsSet;
3129
[NonSerialized] private Spinner spinner;
3230
[NonSerialized] private IProgress progress;
3331
[NonSerialized] private float progressValue;
@@ -269,7 +267,6 @@ private void MaybeUpdateData()
269267
progressMessage = progress.Message;
270268
}
271269

272-
gitExecutableIsSet = !String.IsNullOrEmpty(Environment.GitExecutablePath);
273270
string updatedRepoRemote = null;
274271
string updatedRepoUrl = DefaultRepoUrl;
275272

0 commit comments

Comments
 (0)