regexp-ignore-case only appears in git 1.5.3
regexp-ignore-case only appears in git 1.5.3

--- a/include/git/GitExe.class.php
+++ b/include/git/GitExe.class.php
@@ -193,5 +193,30 @@
 
 	}
 
+	/**
+	 * CanIgnoreRegexpCase
+	 *
+	 * Tests if this version of git has the regexp tuning option to ignore regexp case
+	 *
+	 * @access public
+	 * @return true if we can ignore regexp case
+	 */
+	public function CanIgnoreRegexpCase()
+	{
+		$version = $this->GetVersion();
+		if (!empty($version)) {
+			$splitver = explode('.', $version);
+
+			/*
+			 * regexp-ignore-case only appears in git 1.5.3
+			 */
+			if (($splitver[0] < 1) || (($splitver[0] == 1) && ($splitver[1] < 5)) || (($splitver[0] == 1) && ($splitver[1] == 5) && ($splitver[2] < 3))) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
 }
 

--- a/include/git/Project.class.php
+++ b/include/git/Project.class.php
@@ -863,7 +863,12 @@
 			return;
 
 		$args = array();
-		$args[] = '--regexp-ignore-case';
+
+		$exe = new GitPHP_GitExe($this);
+		if ($exe->CanIgnoreRegexpCase())
+			$args[] = '--regexp-ignore-case';
+		unset($exe);
+
 		$args[] = '--grep=\'' . $pattern . '\'';
 
 		$ret = $this->RevList($hash, $count, $skip, $args);
@@ -893,7 +898,12 @@
 			return;
 
 		$args = array();
-		$args[] = '--regexp-ignore-case';
+
+		$exe = new GitPHP_GitExe($this);
+		if ($exe->CanIgnoreRegexpCase())
+			$args[] = '--regexp-ignore-case';
+		unset($exe);
+
 		$args[] = '--author=\'' . $pattern . '\'';
 
 		$ret = $this->RevList($hash, $count, $skip, $args);
@@ -923,7 +933,12 @@
 			return;
 
 		$args = array();
-		$args[] = '--regexp-ignore-case';
+
+		$exe = new GitPHP_GitExe($this);
+		if ($exe->CanIgnoreRegexpCase())
+			$args[] = '--regexp-ignore-case';
+		unset($exe);
+
 		$args[] = '--committer=\'' . $pattern . '\'';
 
 		$ret = $this->RevList($hash, $count, $skip, $args);

comments