From a8ab0a2db490c7e00d74fdede6c83ec656c192d3 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 27 Apr 2011 12:04:51 +0200 Subject: [PATCH] repo: add support for renames and names with spaces in FormatCommitMessage method --- SparkleLib/SparkleRepo.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index ce02e21c..a3fa538a 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -903,9 +903,9 @@ namespace SparkleLib { // Creates a pretty commit message based on what has changed private string FormatCommitMessage () { - List Added = new List (); - List Modified = new List (); - List Removed = new List (); + List Added = new List (); + List Modified = new List (); + List Removed = new List (); string file_name = ""; string message = null; @@ -925,11 +925,15 @@ namespace SparkleLib { Modified.Add (line.Substring (2)); else if (line.StartsWith ("D")) Removed.Add (line.Substring (2)); + else if (line.StartsWith ("R")) { + Removed.Add (line.Substring (3, (line.IndexOf (" -> ") - 3))); + Added.Add (line.Substring (line.IndexOf (" -> ") + 4)); + } } if (Added.Count > 0) { foreach (string added in Added) { - file_name = added; + file_name = added.Trim ("\"".ToCharArray ()); break; } @@ -938,7 +942,7 @@ namespace SparkleLib { if (Modified.Count > 0) { foreach (string modified in Modified) { - file_name = modified; + file_name = modified.Trim ("\"".ToCharArray ()); break; } @@ -947,7 +951,7 @@ namespace SparkleLib { if (Removed.Count > 0) { foreach (string removed in Removed) { - file_name = removed; + file_name = removed.Trim ("\"".ToCharArray ()); break; }