File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ namespace CandyCoded.GitStatus
12
12
public static class GitStatus
13
13
{
14
14
15
+ public static bool isGitRepo ;
16
+
17
+ public static string status = "" ;
18
+
15
19
public static string branch = "HEAD" ;
16
20
17
21
public static string [ ] branches = { } ;
@@ -42,6 +46,23 @@ public static void Update()
42
46
public static async void UpdateAsync ( )
43
47
{
44
48
49
+ try
50
+ {
51
+
52
+ status = await Git . Status ( ) ;
53
+
54
+ isGitRepo = true ;
55
+
56
+ }
57
+ catch ( Exception error )
58
+ {
59
+
60
+ status = error . Message ;
61
+
62
+ isGitRepo = false ;
63
+
64
+ }
65
+
45
66
branch = await Git . Branch ( ) ;
46
67
branches = await Git . Branches ( ) ;
47
68
changedFiles = await Git . ChangedFiles ( ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,25 @@ public static void ShowWindow()
23
23
private void OnGUI ( )
24
24
{
25
25
26
+ if ( ! GitStatus . isGitRepo )
27
+ {
28
+
29
+ if ( GUILayout . Button ( "Initialize git repo" ) )
30
+ {
31
+
32
+ Task . Run ( async ( ) =>
33
+ {
34
+
35
+ await Git . Init ( ) ;
36
+
37
+ } ) ;
38
+
39
+ }
40
+
41
+ return ;
42
+
43
+ }
44
+
26
45
GUILayout . Space ( 5 ) ;
27
46
28
47
var selectedBranch = Array . IndexOf ( GitStatus . branches , GitStatus . branch ) ;
You can’t perform that action at this time.
0 commit comments