repo git: rewrite HasLocalChanges

This commit is contained in:
Hylke Bons 2012-07-02 23:58:37 +02:00
parent aeafa39c0d
commit 9692ca655e

View file

@ -366,19 +366,10 @@ namespace SparkleLib.Git {
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain"); SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
git.Start (); git.Start ();
// Reading the standard output HAS to go before string output = git.StandardOutput.ReadToEnd ().Trim ();
// WaitForExit, or it will hang forever on output > 4096 bytes
string output = git.StandardOutput.ReadToEnd ().TrimEnd ();
git.WaitForExit (); git.WaitForExit ();
string [] lines = output.Split ("\n".ToCharArray ()); return !string.IsNullOrEmpty (output);
foreach (string line in lines) {
if (line.Trim ().Length > 0)
return true;
}
return false;
} }
} }
@ -472,7 +463,8 @@ namespace SparkleLib.Git {
ResolveConflict (); ResolveConflict ();
} catch (IOException e) { } catch (IOException e) {
SparkleHelpers.DebugInfo ("Git", Name + " | Failed to resolve conflict, trying again..."); SparkleHelpers.DebugInfo ("Git",
Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
} }
} }