@@ -26,25 +26,36 @@ private void OnGUI()
26
26
27
27
var selectedBranch = Array . IndexOf ( GitStatus . branches , GitStatus . branch ) ;
28
28
29
- selectedBranch = EditorGUILayout . Popup ( "Branch:" , selectedBranch , GitStatus . branches ) ;
29
+ if ( selectedBranch == - 1 )
30
+ {
31
+
32
+ GUILayout . Label ( $ "Branch: { GitStatus . branch } ") ;
30
33
31
- if ( ! GitStatus . branches [ selectedBranch ] . Equals ( GitStatus . branch ) )
34
+ }
35
+ else
32
36
{
33
37
34
- if ( GitStatus . changedFiles ? . Length > 0 )
38
+ selectedBranch = EditorGUILayout . Popup ( "Branch:" , selectedBranch , GitStatus . branches ) ;
39
+
40
+ if ( ! GitStatus . branches [ selectedBranch ] . Equals ( GitStatus . branch ) )
35
41
{
36
42
37
- EditorUtility . DisplayDialog (
38
- "Unable to checkout branch" ,
39
- $ "Unable to checkout { GitStatus . branches [ selectedBranch ] } as with { GitStatus . changedFiles ? . Length } changes. " +
40
- "Commit, discard or stash before checking out a different branch." ,
41
- "Ok" ) ;
43
+ if ( GitStatus . changedFiles ? . Length > 0 )
44
+ {
42
45
43
- }
44
- else
45
- {
46
+ EditorUtility . DisplayDialog (
47
+ "Unable to checkout branch" ,
48
+ $ "Unable to checkout { GitStatus . branches [ selectedBranch ] } as with { GitStatus . changedFiles ? . Length } changes. " +
49
+ "Commit, discard or stash before checking out a different branch." ,
50
+ "Ok" ) ;
51
+
52
+ }
53
+ else
54
+ {
55
+
56
+ Git . CheckoutBranch ( GitStatus . branches [ selectedBranch ] ) ;
46
57
47
- Git . CheckoutBranch ( GitStatus . branches [ selectedBranch ] ) ;
58
+ }
48
59
49
60
}
50
61
0 commit comments