@@ -12,7 +12,7 @@ class GitPathView : Subview
12
12
private const string PathToGit = "Path to Git" ;
13
13
private const string PathToGitLfs = "Path to Git LFS" ;
14
14
private const string GitPathSaveButton = "Save" ;
15
- private const string UseInternalGitButton = "Use bundled git" ;
15
+ private const string SetToBundledGitButton = "Set to bundled git" ;
16
16
private const string FindSystemGitButton = "Find system git" ;
17
17
private const string BrowseButton = "..." ;
18
18
private const string GitInstallBrowseTitle = "Select executable" ;
@@ -96,7 +96,7 @@ public override void OnGUI()
96
96
}
97
97
if ( EditorGUI . EndChangeCheck ( ) )
98
98
{
99
- changingManually = true ;
99
+ changingManually = gitPath != installationState . GitExecutablePath || gitLfsPath != installationState . GitLfsExecutablePath ;
100
100
}
101
101
}
102
102
GUILayout . EndHorizontal ( ) ;
@@ -123,7 +123,7 @@ public override void OnGUI()
123
123
}
124
124
if ( EditorGUI . EndChangeCheck ( ) )
125
125
{
126
- changingManually = true ;
126
+ changingManually = gitPath != installationState . GitExecutablePath || gitLfsPath != installationState . GitLfsExecutablePath ; ;
127
127
errorMessage = "" ;
128
128
}
129
129
}
@@ -147,18 +147,26 @@ public override void OnGUI()
147
147
}
148
148
EditorGUI . EndDisabledGroup ( ) ;
149
149
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 ) ;
151
155
{
152
- GUI . FocusControl ( null ) ;
156
+ if ( GUILayout . Button ( SetToBundledGitButton , GUILayout . ExpandWidth ( false ) ) )
157
+ {
158
+ GUI . FocusControl ( null ) ;
153
159
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
+ }
161
168
}
169
+ EditorGUI . EndDisabledGroup ( ) ;
162
170
163
171
//Find button - for attempting to locate a new install
164
172
if ( GUILayout . Button ( FindSystemGitButton , GUILayout . ExpandWidth ( false ) ) )
@@ -189,7 +197,7 @@ public override void OnGUI()
189
197
}
190
198
isBusy = false ;
191
199
resetToBundled = false ;
192
- resetToSystem = true ;
200
+ resetToSystem = gitPath != installationState . GitExecutablePath || gitLfsPath != installationState . GitLfsExecutablePath ;
193
201
changingManually = false ;
194
202
errorMessage = "" ;
195
203
Redraw ( ) ;
0 commit comments