From 713a88846b7eb7c91f69706a679d44fa76e4fd46 Mon Sep 17 00:00:00 2001
From: rfay <randy@randyfay.com>
Date: Sun, 13 Feb 2011 11:40:23 -0700
Subject: [PATCH] Fix regex to work properly with non-git patches (any patch -p1)

---
 client/review/vcs/git.inc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/client/review/vcs/git.inc b/client/review/vcs/git.inc
index 24b73cc..027451b 100644
--- a/client/review/vcs/git.inc
+++ b/client/review/vcs/git.inc
@@ -29,7 +29,11 @@ class PIFRClientReviewVCS_git implements PIFRClientReviewVCS {
 
   public function get_changed_files($patch) {
     $contents = file_get_contents($patch);
-    preg_match_all('/^[\+-]{3}\s+(.*?)\s/m', $contents, $matches, PREG_SET_ORDER);
+    // This regex looks through the patch file for lines of the format
+    // +++ b/install.php
+    // and removes the '+++ b/' from them, returning the filenames that have
+    // had content added.
+    preg_match_all('%^[\+-]{3}\s+[^/]\/(.*?)\s%m', $contents, $matches, PREG_SET_ORDER);
 
     $files = array();
     foreach ($matches as $match) {
-- 
1.7.0.4

