File tree Expand file tree Collapse file tree 3 files changed +82
-0
lines changed
Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor Expand file tree Collapse file tree 3 files changed +82
-0
lines changed Original file line number Diff line number Diff line change 5
5
using System . Collections . Generic ;
6
6
using System . Diagnostics ;
7
7
using System . Threading . Tasks ;
8
+ using UnityEngine ;
8
9
9
10
namespace CandyCoded . GitStatus
10
11
{
@@ -14,8 +15,12 @@ public static class Git
14
15
15
16
#if UNITY_EDITOR_WIN
16
17
public static string GitPath => "C:\\ Program Files\\ Git\\ cmd\\ git.exe" ;
18
+
19
+ public static string GitLFSPath => "C:\\ Program Files\\ Git LFS\\ git-lfs.exe" ;
17
20
#else
18
21
public static string GitPath => "/usr/local/bin/git" ;
22
+
23
+ public static string GitLFSPath => "/usr/local/bin/git-lfs" ;
19
24
#endif
20
25
21
26
private static Process GenerateProcess ( string path , string arguments )
@@ -113,6 +118,33 @@ public static async Task Init()
113
118
114
119
}
115
120
121
+ public static async Task < string [ ] > LockedFiles ( )
122
+ {
123
+
124
+ var process = await GenerateProcessAsync ( GitLFSPath , "locks --json" ) ;
125
+
126
+ process ? . WaitForExit ( ) ;
127
+
128
+ var locked = new List < string > ( ) ;
129
+
130
+ var locks = JsonUtility . FromJson < Locks > ( $@ "{{""locks"":{ process ? . StandardOutput . ReadToEnd ( ) } }}") . locks ;
131
+
132
+ if ( locks != null )
133
+ {
134
+
135
+ for ( var i = 0 ; i < locks . Length ; i += 1 )
136
+ {
137
+
138
+ locked . Add ( locks [ i ] . path ) ;
139
+
140
+ }
141
+
142
+ }
143
+
144
+ return locked . ToArray ( ) ;
145
+
146
+ }
147
+
116
148
public static async Task < string > Status ( )
117
149
{
118
150
Original file line number Diff line number Diff line change
1
+ // Copyright (c) Scott Doxey. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
2
+
3
+ #if UNITY_EDITOR
4
+ using System ;
5
+
6
+ namespace CandyCoded . GitStatus
7
+ {
8
+
9
+ public struct Locks
10
+ {
11
+
12
+ public Lock [ ] locks ;
13
+
14
+ }
15
+
16
+ [ Serializable ]
17
+ public struct Lock
18
+ {
19
+
20
+ [ Serializable ]
21
+ public struct Owner
22
+ {
23
+
24
+ public string name ;
25
+
26
+ }
27
+
28
+ public long id ;
29
+
30
+ public string path ;
31
+
32
+ public Owner owner ;
33
+
34
+ public string locked_at ;
35
+
36
+ }
37
+
38
+ }
39
+ #endif
You can’t perform that action at this time.
0 commit comments