Skip to content

Commit c49a82e

Browse files
committed
Added Status and Init git methods.
1 parent 7efbef6 commit c49a82e

File tree

1 file changed

+23
-0
lines changed
  • Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor

1 file changed

+23
-0
lines changed

Assets/Plugins/CandyCoded.GitStatus/Scripts/CustomEditor/Git.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,29 @@ public static async Task DiscardChanges(string path)
9999

100100
}
101101

102+
public static async Task Init()
103+
{
104+
105+
await GenerateProcess(GitPath, "init");
106+
107+
}
108+
109+
public static async Task<string> Status()
110+
{
111+
112+
var process = await GenerateProcess(GitPath, "status");
113+
114+
if (process?.StandardError.ReadLine() is string line && line.StartsWith("fatal: not a git repository"))
115+
{
116+
117+
throw new Exception("Path is not a git repository.");
118+
119+
}
120+
121+
return process?.StandardOutput.ReadToEnd();
122+
123+
}
124+
102125
public static async Task<string[]> UntrackedFiles()
103126
{
104127

0 commit comments

Comments
 (0)