git: fix crash when committing renames with spaces. closes #1267

This commit is contained in:
Hylke Bons 2013-05-04 17:06:27 -04:00
parent 329fe4885f
commit 9cf5f544a8

View file

@ -1015,11 +1015,12 @@ namespace SparkleLib.Git {
while (!git_status.StandardOutput.EndOfStream) {
string line = git_status.StandardOutput.ReadLine ();
line = line.Trim ();
if (line.EndsWith (".empty") || line.EndsWith (".empty\""))
line = line.Replace (".empty", "");
if (line.StartsWith (" R")) {
if (line.StartsWith ("R")) {
string path = line.Substring (3, line.IndexOf (" -> ") - 3).Trim ("\"".ToCharArray ());
string moved_to_path = line.Substring (line.IndexOf (" -> ") + 4).Trim ("\"".ToCharArray ());
@ -1027,10 +1028,10 @@ namespace SparkleLib.Git {
message += "> " + EnsureSpecialCharacters (moved_to_path) + "\n";
} else {
if (line.StartsWith (" M")) {
if (line.StartsWith ("M")) {
message += "/";
} else if (line.StartsWith (" D")) {
} else if (line.StartsWith ("D")) {
message += "-";
} else {