From c84afd0f783537a5255ed2637568f242e0356640 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sun, 9 Oct 2011 00:08:16 +0200 Subject: [PATCH] Some git diffs (most likely octopus merges) start with diff --cc, so we have to detect and stop log parsing when this occurs as well. --- src/IDF/Scm/Git.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IDF/Scm/Git.php b/src/IDF/Scm/Git.php index 051085e..b0f7b76 100644 --- a/src/IDF/Scm/Git.php +++ b/src/IDF/Scm/Git.php @@ -513,7 +513,11 @@ class IDF_Scm_Git extends IDF_Scm return false; } - $diffStart = strpos($out, 'diff --git a'); + $diffStart = false; + if (preg_match('/^diff (?:--git a|--cc)/m', $out, $m, PREG_OFFSET_CAPTURE)) { + $diffStart = $m[0][1]; + } + $diff = ''; if ($diffStart !== false) { $log = substr($out, 0, $diffStart);