Skip to content

Commit 404fd07

Browse files
committed
Simplified git class.
1 parent 4e15a83 commit 404fd07

File tree

1 file changed

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

1 file changed

+40
-2
lines changed

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

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,52 @@ public static string[] AllChanges()
100100
public static string[] ChangedFiles()
101101
{
102102

103-
return AllChanges().Except(UntrackedFiles()).ToArray();
103+
var process = Process.Start(new ProcessStartInfo
104+
{
105+
FileName = GitPath,
106+
Arguments = "status --short --untracked-files=no --porcelain",
107+
UseShellExecute = false,
108+
RedirectStandardOutput = true,
109+
RedirectStandardError = true,
110+
CreateNoWindow = true
111+
});
112+
113+
var changes = new List<string>();
114+
115+
while (process?.StandardOutput.ReadLine() is string line)
116+
{
117+
118+
changes.Add(line.Trim().TrimStart('M', ' '));
119+
120+
}
121+
122+
return changes.ToArray();
104123

105124
}
106125

107126
public static string[] UntrackedFiles()
108127
{
109128

110-
return AllChanges().Where(file => file.StartsWith("??")).ToArray();
129+
var process = Process.Start(new ProcessStartInfo
130+
{
131+
FileName = GitPath,
132+
Arguments = "ls-files --others --exclude-standard",
133+
UseShellExecute = false,
134+
RedirectStandardOutput = true,
135+
RedirectStandardError = true,
136+
CreateNoWindow = true
137+
});
138+
139+
var changes = new List<string>();
140+
141+
while (process?.StandardOutput.ReadLine() is string line)
142+
{
143+
144+
changes.Add(line.Trim());
145+
146+
}
147+
148+
return changes.ToArray();
111149

112150
}
113151

0 commit comments

Comments
 (0)