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

Commit dc0ee48

Browse files
Refactoring to use one central function
1 parent 59152da commit dc0ee48

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ public override void OnGUI()
9595

9696
GUI.FocusControl(null);
9797

98-
Manager.SystemSettings.Set(Constants.GitInstallPathKey, newGitExec);
99-
Environment.GitExecutablePath = newGitExec.ToNPath();
100-
gitExecHasChanged = true;
98+
ValidateAndSetGitInstallPath(newGitExec);
10199
}
102100
}
103101
EditorGUI.EndDisabledGroup();
@@ -130,9 +128,7 @@ public override void OnGUI()
130128

131129
if (success)
132130
{
133-
Manager.SystemSettings.Set(Constants.GitInstallPathKey, path);
134-
Environment.GitExecutablePath = path;
135-
gitExecHasChanged = true;
131+
ValidateAndSetGitInstallPath(path);
136132
}
137133

138134
isBusy = false;
@@ -144,6 +140,13 @@ public override void OnGUI()
144140
EditorGUI.EndDisabledGroup();
145141
}
146142

143+
private void ValidateAndSetGitInstallPath(string value)
144+
{
145+
Manager.SystemSettings.Set(Constants.GitInstallPathKey, value);
146+
Environment.GitExecutablePath = value.ToNPath();
147+
gitExecHasChanged = true;
148+
}
149+
147150
private void MaybeUpdateData()
148151
{
149152
if (gitExecHasChanged)

0 commit comments

Comments
 (0)