Skip to content

Commit 48f8f8c

Browse files
committed
Sorted methods.
1 parent 45282bb commit 48f8f8c

File tree

1 file changed

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

1 file changed

+19
-19
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static class Git
1818
public static string GitPath => "/usr/local/bin/git";
1919
#endif
2020

21-
public static Task<Process> GenerateProcess(string path, string arguments)
21+
private static Task<Process> GenerateProcess(string path, string arguments)
2222
{
2323

2424
return Task.Run(() => Process.Start(new ProcessStartInfo
@@ -60,13 +60,6 @@ public static async Task<string[]> Branches()
6060

6161
}
6262

63-
public static void CheckoutBranch(string branch)
64-
{
65-
66-
GenerateProcess(GitPath, $"checkout {branch}");
67-
68-
}
69-
7063
public static async Task<string[]> ChangedFiles()
7164
{
7265

@@ -85,36 +78,43 @@ public static async Task<string[]> ChangedFiles()
8578

8679
}
8780

88-
public static async Task<string[]> UntrackedFiles()
81+
public static void CheckoutBranch(string branch)
8982
{
9083

91-
var process = await GenerateProcess(GitPath, "ls-files --others --exclude-standard");
84+
GenerateProcess(GitPath, $"checkout {branch}");
9285

93-
var changes = new List<string>();
86+
}
9487

95-
while (process?.StandardOutput.ReadLine() is string line)
88+
public static async Task DiscardChanges(string path)
89+
{
90+
91+
var process = await GenerateProcess(GitPath, $@"checkout ""{path}""");
92+
93+
if (process?.StandardError.ReadLine() is string line && line.StartsWith("error: pathspec"))
9694
{
9795

98-
changes.Add(line.Trim());
96+
Debug.LogError("File not tracked by git.");
9997

10098
}
10199

102-
return changes.ToArray();
103-
104100
}
105101

106-
public static async Task DiscardChanges(string path)
102+
public static async Task<string[]> UntrackedFiles()
107103
{
108104

109-
var process = await GenerateProcess(GitPath, $@"checkout ""{path}""");
105+
var process = await GenerateProcess(GitPath, "ls-files --others --exclude-standard");
110106

111-
if (process?.StandardError.ReadLine() is string line && line.StartsWith("error: pathspec"))
107+
var changes = new List<string>();
108+
109+
while (process?.StandardOutput.ReadLine() is string line)
112110
{
113111

114-
Debug.LogError("File not tracked by git.");
112+
changes.Add(line.Trim());
115113

116114
}
117115

116+
return changes.ToArray();
117+
118118
}
119119

120120
}

0 commit comments

Comments
 (0)