From 4acb33ae0d1946f96027ff0bc93424741698ad9c Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 2 Jul 2012 23:58:37 +0200 Subject: [PATCH] repo git: rewrite HasLocalChanges --- SparkleLib/Git/SparkleRepoGit.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 65a08003..5863ea55 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -337,19 +337,10 @@ namespace SparkleLib.Git { SparkleGit git = new SparkleGit (LocalPath, "status --porcelain"); git.Start (); - // Reading the standard output HAS to go before - // WaitForExit, or it will hang forever on output > 4096 bytes - string output = git.StandardOutput.ReadToEnd ().TrimEnd (); + string output = git.StandardOutput.ReadToEnd ().Trim (); git.WaitForExit (); - string [] lines = output.Split ("\n".ToCharArray ()); - - foreach (string line in lines) { - if (line.Trim ().Length > 0) - return true; - } - - return false; + return !string.IsNullOrEmpty (output); } } @@ -443,7 +434,8 @@ namespace SparkleLib.Git { ResolveConflict (); } 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 + ")"); } }