Wrap using the git binary in a class; note that operations on the
Wrap using the git binary in a class; note that operations on the
project list like age and snapshot are broken at the moment

--- a/include/display.git_blame.php
+++ b/include/display.git_blame.php
@@ -20,17 +20,17 @@
 	$cachekey = sha1($project) . "|" . sha1($file) . "|" . $hashbase;
 
 	if (!$tpl->is_cached('blame.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		if (!isset($hashbase))
 			$hashbase = $head;
 		if (!isset($hash) && isset($file))
-			$hash = git_get_hash_by_path($projectroot . $project, $hashbase,$file,"blob");
+			$hash = git_get_hash_by_path($hashbase,$file,"blob");
 		$tpl->assign("hash",$hash);
 		$tpl->assign("hashbase",$hashbase);
 		$tpl->assign("head", $head);
-		if ($co = git_read_commit($projectroot . $project, $hashbase)) {
+		if ($co = git_read_commit($hashbase)) {
 			$tpl->assign("fullnav",TRUE);
-			$refs = read_info_ref($projectroot . $project);
+			$refs = read_info_ref();
 			$tpl->assign("tree",$co['tree']);
 			$tpl->assign("title",$co['title']);
 			if (isset($file))
@@ -43,10 +43,10 @@
 					$tpl->assign("hashbaseref",$refs[$hashbase]);
 			}
 		}
-		$paths = git_path_trees($projectroot . $project, $hashbase, $file);
+		$paths = git_path_trees($hashbase, $file);
 		$tpl->assign("paths",$paths);
 
-		$blamedata = git_parse_blame($projectroot . $project, $file, $hashbase);
+		$blamedata = git_parse_blame($file, $hashbase);
 		$tpl->assign("blamedata",$blamedata);
 
 	}

--- a/include/display.git_blob.php
+++ b/include/display.git_blob.php
@@ -22,18 +22,18 @@
 	$cachekey = sha1($project) . "|" . $hashbase . "|" . $hash . "|" . sha1($file);
 
 	if (!$tpl->is_cached('blob.tpl',$cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		if (!isset($hashbase))
 			$hashbase = $head;
 		if (!isset($hash) && isset($file))
-			$hash = git_get_hash_by_path($projectroot . $project, $hashbase,$file,"blob");
-		$catout = git_cat_file($projectroot . $project, $hash);
+			$hash = git_get_hash_by_path($hashbase,$file,"blob");
+		$catout = git_cat_file($hash);
 		$tpl->assign("hash",$hash);
 		$tpl->assign("hashbase",$hashbase);
 		$tpl->assign("head", $head);
-		if ($co = git_read_commit($projectroot . $project, $hashbase)) {
+		if ($co = git_read_commit($hashbase)) {
 			$tpl->assign("fullnav",TRUE);
-			$refs = read_info_ref($projectroot . $project);
+			$refs = read_info_ref();
 			$tpl->assign("tree",$co['tree']);
 			$tpl->assign("title",$co['title']);
 			if (isset($file))
@@ -46,7 +46,7 @@
 					$tpl->assign("hashbaseref",$refs[$hashbase]);
 			}
 		}
-		$paths = git_path_trees($projectroot . $project, $hashbase, $file);
+		$paths = git_path_trees($hashbase, $file);
 		$tpl->assign("paths",$paths);
 
 		if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true)) {

--- a/include/display.git_blob_plain.php
+++ b/include/display.git_blob_plain.php
@@ -25,7 +25,7 @@
 		else
 			$saveas = $hash . ".txt";
 
-		$buffer = git_cat_file($projectroot . $project, $hash);
+		$buffer = git_cat_file($hash);
 
 		if (GitPHP_Config::GetInstance()->GetValue('filemimetype', true))
 			$mime = file_mime($buffer, $file);
@@ -51,7 +51,7 @@
 
 	if (!$tpl->is_cached('blobplain.tpl', $cachekey)) {
 		if (!$buffer)
-			$buffer = git_cat_file($projectroot . $project, $hash);
+			$buffer = git_cat_file($hash);
 		$tpl->assign("blob", $buffer);
 	}
 	$tpl->display('blobplain.tpl', $cachekey);

--- a/include/display.git_blobdiff.php
+++ b/include/display.git_blobdiff.php
@@ -30,17 +30,17 @@
 		$tpl->assign("hashbase",$hashbase);
 		if (isset($file))
 			$tpl->assign("file",$file);
-		if ($co = git_read_commit($projectroot . $project, $hashbase)) {
+		if ($co = git_read_commit($hashbase)) {
 			$tpl->assign("fullnav",TRUE);
 			$tpl->assign("tree",$co['tree']);
 			$tpl->assign("title",$co['title']);
-			$refs = read_info_ref($projectroot . $project);
+			$refs = read_info_ref();
 			if (isset($refs[$hashbase]))
 				$tpl->assign("hashbaseref",$refs[$hashbase]);
 		}
-		$paths = git_path_trees($projectroot . $project, $hashbase, $file);
+		$paths = git_path_trees($hashbase, $file);
 		$tpl->assign("paths",$paths);
-		$diffout = explode("\n",git_diff($projectroot . $project, $hashparent,($file?$file:$hashparent),$hash,($file?$file:$hash)));
+		$diffout = explode("\n",git_diff($hashparent,($file?$file:$hashparent),$hash,($file?$file:$hash)));
 		$tpl->assign("diff",$diffout);
 	}
 	$tpl->display('blobdiff.tpl', $cachekey);

--- a/include/display.git_blobdiff_plain.php
+++ b/include/display.git_blobdiff_plain.php
@@ -24,7 +24,7 @@
 			echo $ret;
 			return;
 		}
-		$tpl->assign("blobdiff",git_diff($projectroot . $project, $hashparent,($file?"a/".$file:$hashparent),$hash,($file?"b/".$file:$hash)));
+		$tpl->assign("blobdiff",git_diff($hashparent,($file?"a/".$file:$hashparent),$hash,($file?"b/".$file:$hash)));
 	}
 	$tpl->display('blobdiffplain.tpl', $cachekey);
 }

--- a/include/display.git_commit.php
+++ b/include/display.git_commit.php
@@ -20,7 +20,7 @@
 	$cachekey = sha1($project) . "|" . $hash;
 
 	if (!$tpl->is_cached('commit.tpl', $cachekey)) {
-		$co = git_read_commit($projectroot . $project, $hash);
+		$co = git_read_commit($hash);
 		$ad = date_str($co['author_epoch'],$co['author_tz']);
 		$cd = date_str($co['committer_epoch'],$co['committer_tz']);
 		if (isset($co['parent'])) {
@@ -30,14 +30,14 @@
 			$root = "--root";
 			$parent = "";
 		}
-		$diffout = git_diff_tree($projectroot . $project, $root . " " . $parent . " " . $hash, TRUE);
+		$diffout = git_diff_tree($root . " " . $parent . " " . $hash, TRUE);
 		$difftree = explode("\n",$diffout);
 		$tpl->assign("hash",$hash);
 		$tpl->assign("tree",$co['tree']);
 		if (isset($co['parent']))
 			$tpl->assign("parent",$co['parent']);
 		$tpl->assign("title",$co['title']);
-		$refs = read_info_ref($projectroot . $project);
+		$refs = read_info_ref();
 		if (isset($refs[$co['id']]))
 			$tpl->assign("commitref",$refs[$co['id']]);
 		$tpl->assign("author",$co['author']);

--- a/include/display.git_commitdiff.php
+++ b/include/display.git_commitdiff.php
@@ -26,12 +26,12 @@
 			echo $ret;
 			return;
 		}
-		$co = git_read_commit($projectroot . $project, $hash);
+		$co = git_read_commit($hash);
 		if ((!isset($hash_parent)) && (isset($co['parent'])))
 			$hash_parent = $co['parent'];
-		$diffout = git_diff_tree($projectroot . $project, $hash_parent . " " . $hash);
+		$diffout = git_diff_tree($hash_parent . " " . $hash);
 		$difftree = explode("\n",$diffout);
-		$refs = read_info_ref($projectroot . $project);
+		$refs = read_info_ref();
 		$tpl->assign("hash",$hash);
 		$tpl->assign("tree",$co['tree']);
 		$tpl->assign("hashparent",$hash_parent);
@@ -52,11 +52,11 @@
 				$difftreeline["from_type"] = file_type($regs[1]);
 				$difftreeline["to_type"] = file_type($regs[2]);
 				if ($regs[5] == "A")
-					$difftreeline['diffout'] = explode("\n",git_diff($projectroot . $project, null,"/dev/null",$regs[4],"b/" . $regs[6]));
+					$difftreeline['diffout'] = explode("\n",git_diff(null,"/dev/null",$regs[4],"b/" . $regs[6]));
 				else if ($regs[5] == "D")
-					$difftreeline['diffout'] = explode("\n",git_diff($projectroot . $project, $regs[3],"a/" . $regs[6],null,"/dev/null"));
+					$difftreeline['diffout'] = explode("\n",git_diff($regs[3],"a/" . $regs[6],null,"/dev/null"));
 				else if (($regs[5] == "M") && ($regs[3] != $regs[4]))
-					$difftreeline['diffout'] = explode("\n",git_diff($projectroot . $project, $regs[3],"a/" . $regs[6],$regs[4],"b/" . $regs[6]));
+					$difftreeline['diffout'] = explode("\n",git_diff($regs[3],"a/" . $regs[6],$regs[4],"b/" . $regs[6]));
 				$difftreelines[] = $difftreeline;
 			}
 		}

--- a/include/display.git_commitdiff_plain.php
+++ b/include/display.git_commitdiff_plain.php
@@ -31,13 +31,13 @@
 			echo $ret;
 			return;
 		}
-		$co = git_read_commit($projectroot . $project, $hash);
+		$co = git_read_commit($hash);
 		if (!isset($hash_parent))
 			$hash_parent = $co['parent'];
-		$diffout = git_diff_tree($projectroot . $project, $hash_parent . " " . $hash);
+		$diffout = git_diff_tree($hash_parent . " " . $hash);
 		$difftree = explode("\n",$diffout);
-		$refs = read_info_ref($projectroot . $project,"tags");
-		$listout = git_read_revlist($projectroot . $project, "HEAD");
+		$refs = read_info_ref('tags');
+		$listout = git_read_revlist('HEAD');
 		foreach ($listout as $i => $rev) {
 			if (isset($refs[$rev]))
 				$tagname = $refs[$rev];
@@ -56,11 +56,11 @@
 		foreach ($difftree as $i => $line) {
 			if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/",$line,$regs)) {
 				if ($regs[5] == "A")
-					$diffs[] = git_diff($projectroot . $project, null, "/dev/null", $regs[4], "b/" . $regs[6]);
+					$diffs[] = git_diff(null, "/dev/null", $regs[4], "b/" . $regs[6]);
 				else if ($regs[5] == "D")
-					$diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], null, "/dev/null");
+					$diffs[] = git_diff($regs[3], "a/" . $regs[6], null, "/dev/null");
 				else if ($regs[5] == "M")
-					$diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], $regs[4], "b/" . $regs[6]);
+					$diffs[] = git_diff($regs[3], "a/" . $regs[6], $regs[4], "b/" . $regs[6]);
 			}
 		}
 		$tpl->assign("diffs",$diffs);

--- a/include/display.git_heads.php
+++ b/include/display.git_heads.php
@@ -17,7 +17,7 @@
 	$cachekey = sha1($project);
 
 	if (!$tpl->is_cached('heads.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		$tpl->assign("head",$head);
 		$headlist = git_read_refs("refs/heads");
 		$tpl->assign("headlist",$headlist);

--- a/include/display.git_history.php
+++ b/include/display.git_history.php
@@ -22,17 +22,17 @@
 
 	if (!$tpl->is_cached('history.tpl', $cachekey)) {
 		if (!isset($hash))
-			$hash = git_read_head($projectroot . $project);
-		$co = git_read_commit($projectroot . $project, $hash);
-		$refs = read_info_ref($projectroot . $project);
+			$hash = git_read_head();
+		$co = git_read_commit($hash);
+		$refs = read_info_ref();
 		$tpl->assign("hash",$hash);
 		if (isset($refs[$hash]))
 			$tpl->assign("hashbaseref",$refs[$hash]);
 		$tpl->assign("tree",$co['tree']);
 		$tpl->assign("title",$co['title']);
-		$paths = git_path_trees($projectroot . $project, $hash, $file);
+		$paths = git_path_trees($hash, $file);
 		$tpl->assign("paths",$paths);
-		$cmdout = git_history_list($projectroot . $project, $hash, $file);
+		$cmdout = git_history_list($hash, $file);
 		$lines = explode("\n", $cmdout);
 		$historylines = array();
 		foreach ($lines as $i => $line) {
@@ -40,7 +40,7 @@
 				$commit = $regs[1];
 			else if (preg_match("/:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/",$line,$regs) && isset($commit)) {
 					$historyline = array();
-					$co = git_read_commit($projectroot . $project, $commit);
+					$co = git_read_commit($commit);
 					$historyline["agestringage"] = $co['age_string_age'];
 					$historyline["agestringdate"] = $co['age_string_date'];
 					$historyline["authorname"] = $co['author_name'];
@@ -49,8 +49,8 @@
 					$historyline["title"] = $co['title_short'];
 					if (isset($refs[$commit]))
 						$historyline["commitref"] = $refs[$commit];
-					$blob = git_get_hash_by_path($projectroot . $project, $hash,$file);
-					$blob_parent = git_get_hash_by_path($projectroot . $project, $commit,$file);
+					$blob = git_get_hash_by_path($hash,$file);
+					$blob_parent = git_get_hash_by_path($commit,$file);
 					if ($blob && $blob_parent && ($blob != $blob_parent)) {
 						$historyline["blob"] = $blob;
 						$historyline["blobparent"] = $blob_parent;

--- a/include/display.git_log.php
+++ b/include/display.git_log.php
@@ -20,19 +20,19 @@
 	$cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
 
 	if (!$tpl->is_cached('log.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		if (!isset($hash))
 			$hash = $head;
 		if (!isset($page))
 			$page = 0;
-		$refs = read_info_ref($projectroot . $project);
+		$refs = read_info_ref();
 		$tpl->assign("hash",$hash);
 		$tpl->assign("head",$head);
 
 		if ($page)
 			$tpl->assign("page",$page);
 
-		$revlist = git_read_revlist($projectroot . $project, $hash, 101, ($page * 100));
+		$revlist = git_read_revlist($hash, 101, ($page * 100));
 
 		$revlistcount = count($revlist);
 		$tpl->assign("revlistcount",$revlistcount);
@@ -49,7 +49,7 @@
 			$commit = $revlist[$i];
 			if (isset($commit) && strlen($commit) > 1) {
 				$commitline = array();
-				$co = git_read_commit($projectroot . $project, $commit);
+				$co = git_read_commit($commit);
 				$ad = date_str($co['author_epoch']);
 				$commitline["project"] = $project;
 				$commitline["commit"] = $commit;

--- a/include/display.git_rss.php
+++ b/include/display.git_rss.php
@@ -23,15 +23,15 @@
 	$cachekey = sha1($project);
 
 	if (!$tpl->is_cached('rss.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
-		$revlist = git_read_revlist($projectroot . $project, $head, GITPHP_RSS_ITEMS);
+		$head = git_read_head();
+		$revlist = git_read_revlist($head, GITPHP_RSS_ITEMS);
 		$tpl->assign("self",script_url());
 
 		$commitlines = array();
 		$revlistcount = count($revlist);
 		for ($i = 0; $i < $revlistcount; ++$i) {
 			$commit = $revlist[$i];
-			$co = git_read_commit($projectroot . $project, $commit);
+			$co = git_read_commit($commit);
 			if (($i >= 20) && ((time() - $co['committer_epoch']) > 48*60*60))
 				break;
 			$cd = date_str($co['committer_epoch']);
@@ -48,7 +48,7 @@
 
 			if (isset($co['parent'])) {
 				$difftree = array();
-				$diffout = git_diff_tree($projectroot . $project, $co['parent'] . " " . $co['id']);
+				$diffout = git_diff_tree($co['parent'] . " " . $co['id']);
 				$tok = strtok($diffout,"\n");
 				while ($tok !== false) {
 					if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/",$tok,$regs))

--- a/include/display.git_search.php
+++ b/include/display.git_search.php
@@ -31,13 +31,13 @@
 			return;
 		}
 		if (!isset($hash)) {
-			//$hash = git_read_head($projectroot . $project);
+			//$hash = git_read_head();
 			$hash = "HEAD";
 		}
 
-		$co = git_read_commit($projectroot . $project, $hash);
+		$co = git_read_commit($hash);
 
-		$revlist = git_read_revlist($projectroot . $project, $hash, 101, ($page * 100), FALSE, FALSE, $searchtype, $search);
+		$revlist = git_read_revlist($hash, 101, ($page * 100), FALSE, FALSE, $searchtype, $search);
 		if (count($revlist) < 1 || (strlen($revlist[0]) < 1)) {
 			git_message("No matches for '" . $search . "'.", FALSE, TRUE);
 			return;
@@ -60,7 +60,7 @@
 			$commit = $revlist[$i];
 			if (strlen(trim($commit)) > 0) {
 				$commitline = array();
-				$co2 = git_read_commit($projectroot . $project, $commit);
+				$co2 = git_read_commit($commit);
 				$commitline["commit"] = $commit;
 				$commitline["agestringage"] = $co2['age_string_age'];
 				$commitline["agestringdate"] = $co2['age_string_date'];

--- a/include/display.git_search_files.php
+++ b/include/display.git_search_files.php
@@ -31,13 +31,13 @@
 			return;
 		}
 		if (!isset($hash)) {
-			//$hash = git_read_head($projectroot . $project);
+			//$hash = git_read_head();
 			$hash = "HEAD";
 		}
 
-		$co = git_read_commit($projectroot . $project, $hash);
+		$co = git_read_commit($hash);
 
-		$filesearch = git_filesearch($projectroot . $project, $hash, $search, false, ($page * 100), 101);
+		$filesearch = git_filesearch($hash, $search, false, ($page * 100), 101);
 
 		if (count($filesearch) < 1) {
 			git_message("No matches for '" . $search . "'.", FALSE, TRUE);

--- a/include/display.git_shortlog.php
+++ b/include/display.git_shortlog.php
@@ -20,19 +20,19 @@
 	$cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
 
 	if (!$tpl->is_cached('shortlog.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		if (!isset($hash))
 			$hash = $head;
 		if (!isset($page))
 			$page = 0;
-		$refs = read_info_ref($projectroot . $project);
+		$refs = read_info_ref();
 		$tpl->assign("hash",$hash);
 		$tpl->assign("head",$head);
 
 		if ($page)
 			$tpl->assign("page",$page);
 
-		$revlist = git_read_revlist($projectroot . $project, $hash, 101, ($page * 100));
+		$revlist = git_read_revlist($hash, 101, ($page * 100));
 
 		$revlistcount = count($revlist);
 		$tpl->assign("revlistcount",$revlistcount);
@@ -45,7 +45,7 @@
 				$commitline = array();
 				if (isset($refs[$commit]))
 					$commitline["commitref"] = $refs[$commit];
-				$co = git_read_commit($projectroot . $project, $commit);
+				$co = git_read_commit($commit);
 				$ad = date_str($co['author_epoch']);
 				$commitline["commit"] = $commit;
 				$commitline["agestringage"] = $co['age_string_age'];

--- a/include/display.git_snapshot.php
+++ b/include/display.git_snapshot.php
@@ -43,7 +43,7 @@
 
 	if (!$tpl->is_cached('snapshot.tpl', $cachekey)) {
 
-		$arc = git_archive($projectroot . $project, $hash, $rname,
+		$arc = git_archive($hash, $rname,
 			(($compressformat == GITPHP_COMPRESS_ZIP) ? "zip" : "tar"));
 
 		if (($compressformat == GITPHP_COMPRESS_BZ2) && $bzcompress) {

--- a/include/display.git_summary.php
+++ b/include/display.git_summary.php
@@ -30,11 +30,11 @@
 		$projectroot = GitPHP_Config::GetInstance()->GetValue('projectroot');
 
 		$descr = $gitphp_current_project->GetDescription();
-		$head = git_read_head($projectroot . $project);
-		$commit = git_read_commit($projectroot . $project, $head);
+		$head = git_read_head();
+		$commit = git_read_commit($head);
 		$commitdate = date_str($commit['committer_epoch'],$commit['committer_tz']);
 		$owner = $gitphp_current_project->GetOwner();
-		$refs = read_info_ref($projectroot . $project);
+		$refs = read_info_ref();
 		$tpl->assign("head",$head);
 		$tpl->assign("description",$descr);
 		$tpl->assign("owner",$owner);
@@ -43,10 +43,10 @@
 			$tpl->assign('cloneurl', GitPHP_Config::GetInstance()->GetValue('cloneurl') . $project);
 		if (GitPHP_Config::GetInstance()->HasKey('pushurl'))
 			$tpl->assign('pushurl', GitPHP_Config::GetInstance()->GetValue('pushurl') . $project);
-		$revlist = git_read_revlist($projectroot . $project, $head, 17);
+		$revlist = git_read_revlist($head, 17);
 		foreach ($revlist as $i => $rev) {
 			$revdata = array();
-			$revco = git_read_commit($projectroot . $project, $rev);
+			$revco = git_read_commit($rev);
 			$authordate = date_str($revco['author_epoch']);
 			$revdata["commit"] = $rev;
 			if (isset($refs[$rev]))

--- a/include/display.git_tag.php
+++ b/include/display.git_tag.php
@@ -19,11 +19,11 @@
 
 	if (!$tpl->is_cached('tag.tpl', $cachekey)) {
 
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		$tpl->assign("head",$head);
 		$tpl->assign("hash", $hash);
 
-		$tag = git_read_tag($projectroot . $project, $hash);
+		$tag = git_read_tag($hash);
 
 		$tpl->assign("tag",$tag);
 		if (isset($tag['author'])) {

--- a/include/display.git_tags.php
+++ b/include/display.git_tags.php
@@ -17,7 +17,7 @@
 	$cachekey = sha1($project);
 
 	if (!$tpl->is_cached('tags.tpl', $cachekey)) {
-		$head = git_read_head($projectroot . $project);
+		$head = git_read_head();
 		$tpl->assign("head",$head);
 		$taglist = git_read_refs("refs/tags");
 		if (isset($taglist) && (count($taglist) > 0)) {

--- a/include/display.git_tree.php
+++ b/include/display.git_tree.php
@@ -23,25 +23,25 @@
 
 	if (!$tpl->is_cached('tree.tpl', $cachekey)) {
 		if (!isset($hash)) {
-			$hash = git_read_head($projectroot . $project);
+			$hash = git_read_head();
 			if (isset($file))
-				$hash = git_get_hash_by_path($projectroot . $project, ($hashbase?$hashbase:$hash),$file,"tree");
+				$hash = git_get_hash_by_path(($hashbase?$hashbase:$hash),$file,"tree");
 				if (!isset($hashbase))
 					$hashbase = $hash;
 		}
-		$lsout = git_ls_tree($projectroot . $project, $hash, TRUE);
-		$refs = read_info_ref($projectroot . $project);
+		$lsout = git_ls_tree($hash, TRUE);
+		$refs = read_info_ref();
 		$tpl->assign("hash",$hash);
 		if (isset($hashbase))
 			$tpl->assign("hashbase",$hashbase);
-		if (isset($hashbase) && ($co = git_read_commit($projectroot . $project, $hashbase))) {
+		if (isset($hashbase) && ($co = git_read_commit($hashbase))) {
 			$basekey = $hashbase;
 			$tpl->assign("fullnav",TRUE);
 			$tpl->assign("title",$co['title']);
 			if (isset($refs[$hashbase]))
 				$tpl->assign("hashbaseref",$refs[$hashbase]);
 		}
-		$paths = git_path_trees($projectroot . $project, $hashbase, $file);
+		$paths = git_path_trees($hashbase, $file);
 		$tpl->assign("paths",$paths);
 
 		if (isset($file))

--- /dev/null
+++ b/include/git/GitExe.class.php
@@ -1,1 +1,111 @@
+<?php
+/**
+ * GitPHP GitExe
+ *
+ * Class to wrap git executable
+ *
+ * @author Christopher Han <xiphux@gmail.com>
+ * @copyright Copyright (c) 2010 Christopher Han
+ * @package GitPHP
+ * @subpackage Git
+ */
 
+/**
+ * Git Executable class
+ *
+ * @package GitPHP
+ * @subpackage Git
+ */
+class GitPHP_GitExe
+{
+	/**
+	 * project
+	 *
+	 * Stores the project internally
+	 *
+	 * @access protected
+	 */
+	protected $project;
+
+	/**
+	 * bin
+	 *
+	 * Stores the binary path internally
+	 *
+	 * @access protected
+	 */
+	protected $binary;
+
+	/**
+	 * __construct
+	 *
+	 * Constructor
+	 *
+	 * @param string $binary path to git binary
+	 * @param mixed $project project to operate on
+	 * @return mixed git executable class
+	 */
+	public function __construct($binary, $project = null)
+	{
+		if (empty($binary)) {
+			// try to pick a reasonable default
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				$this->binary = 'C:\\Progra~1\\Git\\bin\\git.exe';
+			} else {
+				$this->binary = 'git';
+			}
+		} else {
+			$this->binary = $binary;
+		}
+
+		$this->SetProject($project);
+	}
+
+	/**
+	 * SetProject
+	 *
+	 * Sets the project for this executable
+	 *
+	 * @param mixed $project project to set
+	 */
+	public function SetProject($project = null)
+	{
+		$this->project = $project;
+	}
+
+	/**
+	 * Execute
+	 *
+	 * Executes a command
+	 *
+	 * @param string $command the command to execute
+	 * @param array $args arguments
+	 * @return string result of command
+	 */
+	public function Execute($command, $args)
+	{
+		$gitDir = '';
+		if ($this->project) {
+			$gitDir = '--git-dir=' . $this->project->GetPath();
+		}
+		
+		$fullCommand = $this->binary . ' ' . $gitDir . ' ' . $command . ' ' . implode(' ', $args);
+
+		return shell_exec($fullCommand);
+	}
+
+	/**
+	 * GetBinary
+	 *
+	 * Gets the binary for this executable
+	 *
+	 * @return string $param
+	 * @access public
+	 */
+	public function GetBinary()
+	{
+		return $this->binary;
+	}
+
+}
+

--- a/include/gitutil.git_archive.php
+++ b/include/gitutil.git_archive.php
@@ -8,15 +8,23 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_archive($proj,$hash,$rname = NULL, $fmt = "tar")
+function git_archive($hash,$rname = NULL, $fmt = "tar")
 {
-	$cmd = GIT_ARCHIVE . " --format=" . $fmt;
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+	$args[] = '--format=' . $fmt;
 	if ($rname)
-		$cmd .= " --prefix=" . $rname . "/";
-	$cmd .= " " . $hash;
-	return git_exec($proj, $cmd);
+		$args[] = '--prefix=' . $rname . '/';
+	$args[] = $hash;
+	return $exe->Execute(GIT_ARCHIVE, $args);
 }
 
 ?>

--- a/include/gitutil.git_cat_file.php
+++ b/include/gitutil.git_cat_file.php
@@ -8,14 +8,23 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_cat_file($proj,$hash,$pipeto = NULL, $type = "blob")
+function git_cat_file($hash,$pipeto = NULL, $type = "blob")
 {
-	$cmd = GIT_CAT_FILE . " " . $type . " " . $hash;
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+	$args[] = $type;
+	$args[] = $hash;
 	if ($pipeto)
-		$cmd .= " > " . $pipeto;
-	return git_exec($proj, $cmd);
+		$args[] = ' > ' . $pipeto;
+	return $exe->Execute(GIT_CAT_FILE, $args);
 }
 
 ?>

--- a/include/gitutil.git_diff.php
+++ b/include/gitutil.git_diff.php
@@ -9,7 +9,7 @@
 
 require_once('gitutil.git_cat_file.php');
 
-function git_diff($proj,$from,$from_name,$to,$to_name)
+function git_diff($from,$from_name,$to,$to_name)
 {
 	$from_tmp = "/dev/null";
 	$to_tmp = "/dev/null";
@@ -20,11 +20,11 @@
 	$tmpdir = GitPHP_Config::GetInstance()->GetValue('gittmp', '/tmp/gitphp/');
 	if (isset($from)) {
 		$from_tmp = $tmpdir . "gitphp_" . $pid . "_from";
-		git_cat_file($proj,$from,$from_tmp);
+		git_cat_file($from,$from_tmp);
 	}
 	if (isset($to)) {
 		$to_tmp = $tmpdir . "gitphp_" . $pid . "_to";
-		git_cat_file($proj,$to,$to_tmp);
+		git_cat_file($to,$to_tmp);
 	}
 	$out = shell_exec(GitPHP_Config::GetInstance()->GetValue('diffbin', 'diff') . " -u -p -L '" . $from_name . "' -L '" . $to_name . "' " . $from_tmp . " " . $to_tmp);
 	if (isset($from))

--- a/include/gitutil.git_diff_tree.php
+++ b/include/gitutil.git_diff_tree.php
@@ -8,14 +8,23 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_diff_tree($proj,$hashes,$renames = FALSE)
+function git_diff_tree($hashes,$renames = FALSE)
 {
-	$cmd = GIT_DIFF_TREE . " -r ";
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+	$args[] = '-r';
 	if ($renames)
-		$cmd .= "-M ";
-	return git_exec($proj, $cmd . $hashes);
+		$args[] = '-M';
+	$args[] = $hashes;
+	return $exe->Execute(GIT_DIFF_TREE, $args);
 }
 
 ?>

--- a/include/gitutil.git_exec.php
+++ /dev/null
@@ -1,24 +1,1 @@
-<?php
-/*
- *  gitutil.git_exec.php
- *  gitphp: A PHP git repository browser
- *  Component: Git utility - execute git command depending on platform
- *
- *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
- */
 
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
- 	require_once('gitutil.git_exec_win.php');
- else
- 	require_once('gitutil.git_exec_nix.php');
-
-function git_exec($project, $command)
-{
-	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
-		return git_exec_win($project, $command);
-	else
-		return git_exec_nix($project, $command);
-}
-
-?>
-

--- a/include/gitutil.git_exec_nix.php
+++ /dev/null
@@ -1,20 +1,1 @@
-<?php
-/*
- *  gitutil.git_exec_nix.php
- *  gitphp: A PHP git repository browser
- *  Component: Git utility - execute git command on *nix
- *
- *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
- */
 
- function git_exec_nix($project, $command)
- {
-	$cmd = GitPHP_Config::GetInstance()->GetValue('gitbin', 'git');
-	if (isset($project) && (strlen($project) > 0))
-		$cmd .= " --git-dir=" . $project;
-	$cmd .= " " . $command;
-	return shell_exec($cmd);
- }
-
-?>
-

--- a/include/gitutil.git_exec_win.php
+++ /dev/null
@@ -1,20 +1,1 @@
-<?php
-/*
- *  gitutil.git_exec_win.php
- *  gitphp: A PHP git repository browser
- *  Component: Git utility - execute git command on windows
- *
- *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
- */
 
-function git_exec_win($project, $command)
-{
-	$cmd = GitPHP_Config::GetInstance()->GetValue('gitbin', 'C:\\Progra~1\\Git\\bin\\git.exe');
-	if (isset($project) && (strlen($project) > 0))
-		$cmd .= " --git-dir=" . $project;
-	$cmd .= " " . $command;
-	return shell_exec($cmd);
-}
-
-?>
-

--- a/include/gitutil.git_filesearch.php
+++ b/include/gitutil.git_filesearch.php
@@ -10,14 +10,14 @@
 require_once('gitutil.git_grep.php');
 require_once('gitutil.git_ls_tree.php');
 
-function git_filesearch($project, $hash, $search, $case = false, $skip = 0, $count = 100)
+function git_filesearch($hash, $search, $case = false, $skip = 0, $count = 100)
 {
 	$matches = array();
 	
 	/*
 	 * Search file contents
 	 */
-	$grepout = git_grep($project, $hash, $search, $case, false, true);
+	$grepout = git_grep($hash, $search, $case, false, true);
 	$lines = explode("\n",$grepout);
 	foreach ($lines as $j => $line) {
 		if ($case)
@@ -37,7 +37,7 @@
 	/*
 	 * Search filenames
 	 */
-	 $lsout = git_ls_tree($project, $hash, false, true);
+	 $lsout = git_ls_tree($hash, false, true);
 	 $entries = explode("\n",$lsout);
 	 foreach ($entries as $j => $line) {
 		$ret = preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)/",$line,$regs);

--- a/include/gitutil.git_get_hash_by_path.php
+++ b/include/gitutil.git_get_hash_by_path.php
@@ -9,13 +9,13 @@
 
 require_once('gitutil.git_ls_tree.php');
 
-function git_get_hash_by_path($project,$base,$path,$type = null)
+function git_get_hash_by_path($base,$path,$type = null)
 {
 	$tree = $base;
 	$parts = explode("/",$path);
 	$partcount = count($parts);
 	foreach ($parts as $i => $part) {
-		$lsout = git_ls_tree($project, $tree);
+		$lsout = git_ls_tree($tree);
 		$entries = explode("\n",$lsout);
 		foreach ($entries as $j => $line) {
 			if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/",$line,$regs)) {

--- a/include/gitutil.git_get_type.php
+++ b/include/gitutil.git_get_type.php
@@ -9,9 +9,9 @@
 
 require_once('gitutil.git_cat_file.php');
 
-function git_get_type($project, $hash)
+function git_get_type($hash)
 {
-	return trim(git_cat_file($project,$hash,NULL,"-t"));
+	return trim(git_cat_file($hash,NULL,"-t"));
 }
 
 ?>

--- a/include/gitutil.git_grep.php
+++ b/include/gitutil.git_grep.php
@@ -8,19 +8,28 @@
  */
 
 require_once('defs.commands.php');
-require_once('gitutil.git_exec.php');
+require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_grep($project, $hash, $search, $case = false, $binary = false, $fullname = true)
+function git_grep($hash, $search, $case = false, $binary = false, $fullname = true)
 {
-	$cmd = GIT_GREP;
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
 	if (!$binary)
-		$cmd .= " -I";
+		$args[] = '-I';
 	if ($fullname)
-		$cmd .= " --full-name";
+		$args[] = '--full-name';
 	if (!$case)
-		$cmd .= " --ignore-case";
-	$cmd .= " -e " . $search;
-	return git_exec($project, $cmd . " " . $hash);
+		$args[] = '--ignore-case';
+	$args[] = '-e';
+	$args[] = $search;
+	$args[] = $hash;
+	return $exe->Execute(GIT_GREP, $args);
 }
 
 ?>

--- a/include/gitutil.git_history_list.php
+++ b/include/gitutil.git_history_list.php
@@ -8,12 +8,27 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_history_list($proj,$hash,$file)
+function git_history_list($hash,$file)
 {
-	$cmd = GIT_REV_LIST . " " . $hash . " | " . GitPHP_Config::GetInstance()->GetValue('gitbin', 'git') . " --git-dir=" . $proj . " " . GIT_DIFF_TREE . " -r --stdin -- " . $file;
-	return git_exec($proj, $cmd);
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+	$args[] = $hash;
+	$args[] = '|';
+	$args[] = $exe->GetBinary();
+	$args[] = '--git-dir=' . $gitphp_current_project->GetPath();
+	$args[] = GIT_DIFF_TREE;
+	$args[] = '-r';
+	$args[] = '--stdin';
+	$args[] = $file;
+	return $exe->Execute(GIT_REV_LIST, $args);
 }
 
 ?>

--- a/include/gitutil.git_ls_tree.php
+++ b/include/gitutil.git_ls_tree.php
@@ -8,16 +8,27 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_ls_tree($proj,$hash,$nullterm = FALSE, $recurse = FALSE)
+function git_ls_tree($hash,$nullterm = FALSE, $recurse = FALSE)
 {
-	$cmd = GIT_LS_TREE;
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
 	if ($nullterm)
-		$cmd .= " -z";
-	if ($recurse)
-		$cmd .= " -r -t --full-name";
-	return git_exec($proj, $cmd . " " . $hash);
+		$args[] = '-z';
+	if ($recurse) {
+		$args[] = '-r';
+		$args[] = '-t';
+		$args[] = '--full-name';
+	}
+	$args[] = $hash;
+	return $exe->Execute(GIT_LS_TREE, $args);
 }
 
 ?>

--- a/include/gitutil.git_parse_blame.php
+++ b/include/gitutil.git_parse_blame.php
@@ -10,9 +10,9 @@
 require_once('gitutil.git_read_blame.php');
 require_once('util.date_str.php');
 
-function git_parse_blame($proj, $file, $rev = null)
+function git_parse_blame($file, $rev = null)
 {
-	$lines = explode("\n", git_read_blame($proj, $file, $rev));
+	$lines = explode("\n", git_read_blame($file, $rev));
 
 	if (count($lines) < 1)
 		return null;

--- a/include/gitutil.git_path_tree.php
+++ b/include/gitutil.git_path_tree.php
@@ -9,7 +9,7 @@
 
 require_once('gitutil.git_get_hash_by_path.php');
 
-function git_path_tree($project,$base,$filename)
+function git_path_tree($base,$filename)
 {
 	if (strlen($filename) < 1)
 		return null;
@@ -20,7 +20,7 @@
 	if ($spos !== false)
 		$spath = substr($spath, $spos+1);
 	$path['short'] = $spath;
-	$path['tree'] = git_get_hash_by_path($project, $base, $filename);
+	$path['tree'] = git_get_hash_by_path($base, $filename);
 	return $path;
 }
 

--- a/include/gitutil.git_path_trees.php
+++ b/include/gitutil.git_path_trees.php
@@ -10,17 +10,17 @@
 require_once('gitutil.git_path_tree.php');
 require_once('gitutil.git_get_hash_by_path.php');
 
-function git_path_trees($project,$base,$filename)
+function git_path_trees($base,$filename)
 {
 	$paths = array();
-	$path = git_path_tree($project,$base,$filename);
+	$path = git_path_tree($base,$filename);
 	if ($path != null)
 		$paths[] = $path;
 	$pos = strrpos($filename, "/");
 	while ($pos !== false) {
 		$filename = substr($filename,0,$pos);
 		
-		$path = git_path_tree($project, $base, $filename);
+		$path = git_path_tree($base, $filename);
 		if ($path != null)
 			$paths[] = $path;
 

--- a/include/gitutil.git_project_info.php
+++ b/include/gitutil.git_project_info.php
@@ -17,9 +17,9 @@
 	$projinfo = array();
 	$projinfo["project"] = $project;
 	$projinfo["descr"] = $projectObj->GetDescription(true);
-	$projinfo["owner"] = $projectObj->GetOwner();;
-	$head = git_read_head($projectroot . $project);
-	$commit = git_read_commit($projectroot . $project,$head);
+	$projinfo["owner"] = $projectObj->GetOwner();
+	$head = git_read_head();
+	$commit = git_read_commit($head);
 	$projinfo["age"] = $commit['age'];
 	$projinfo["age_string"] = $commit['age_string'];
 	return $projinfo;

--- a/include/gitutil.git_read_blame.php
+++ b/include/gitutil.git_read_blame.php
@@ -8,14 +8,24 @@
  */
 
 require_once('defs.commands.php');
-require_once('gitutil.git_exec.php');
+require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_read_blame($proj, $file, $rev = null)
+function git_read_blame($file, $rev = null)
 {
-	$cmd = GIT_BLAME . " -p";
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+
+	$args[] = '-p';	
 	if ($rev)
-		$cmd .= " " . $rev;
-	return git_exec($proj, $cmd . " " . $file);
+		$args[] = $rev;
+	$args[] = $file;
+	return $exe->Execute(GIT_BLAME, $args);
 }
 
 ?>

--- a/include/gitutil.git_read_commit.php
+++ b/include/gitutil.git_read_commit.php
@@ -11,9 +11,9 @@
  require_once('util.age_string.php');
  require_once('gitutil.git_read_revlist.php');
 
-function git_read_commit($proj,$head)
+function git_read_commit($head)
 {
-	$lines = git_read_revlist($proj,$head,1,NULL,TRUE,TRUE);
+	$lines = git_read_revlist($head,1,NULL,TRUE,TRUE);
 	if (!($lines[0]) || !preg_match("/^[0-9a-fA-F]{40}/",$lines[0]))
 		return null;
 	$commit = array();

--- a/include/gitutil.git_read_head.php
+++ b/include/gitutil.git_read_head.php
@@ -8,12 +8,21 @@
  */
 
 require_once('defs.commands.php');
-require_once('gitutil.git_exec.php');
+require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_read_head($proj)
+function git_read_head()
 {
-	$cmd = GIT_REV_PARSE . " --verify HEAD";
-	return trim(git_exec($proj, $cmd));
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+	$args[] = '--verify';
+	$args[] = 'HEAD';
+	return trim($exe->Execute(GIT_REV_PARSE, $args));
 }
 
 ?>

--- a/include/gitutil.git_read_ref.php
+++ b/include/gitutil.git_read_ref.php
@@ -22,7 +22,7 @@
 	$projectroot = GitPHP_Config::GetInstance()->GetValue('projectroot');
 	$project = $gitphp_current_project->GetProject();
 
-	$type = git_get_type($projectroot . $project, $ref_id);
+	$type = git_get_type($ref_id);
 
 	if (!$type)
 		return null;
@@ -34,10 +34,10 @@
 	$ref_item['age_string'] = "unknown";
 
 	if ($type == "tag") {
-		$tag = git_read_tag($projectroot . $project, $ref_id);
+		$tag = git_read_tag($ref_id);
 		$ref_item['comment'] = $tag['comment'];
 		if ($tag['type'] == "commit") {
-			$co = git_read_commit($projectroot . $project, $tag['object']);
+			$co = git_read_commit($tag['object']);
 			$ref_item['epoch'] = $co['committer_epoch'];
 			$ref_item['age_string'] = $co['age_string'];
 			$ref_item['age'] = $co['age'];
@@ -51,7 +51,7 @@
 		$ref_item['name'] = $tag['name'];
 		$ref_item['refid'] = $tag['object'];
 	} else if ($type == "commit") {
-		$co = git_read_commit($projectroot . $project, $ref_id);
+		$co = git_read_commit($ref_id);
 		$ref_item['reftype'] = "commit";
 		$ref_item['name'] = $ref_file;
 		$ref_item['title'] = $co['title'];

--- a/include/gitutil.git_read_revlist.php
+++ b/include/gitutil.git_read_revlist.php
@@ -10,7 +10,7 @@
  require_once('gitutil.git_rev_list.php');
  require_once('gitutil.git_version.php');
 
-function git_read_revlist($proj,$head,$count = NULL,$skip = NULL,$header = FALSE,$parents = FALSE,$greptype = NULL, $search = NULL)
+function git_read_revlist($head,$count = NULL,$skip = NULL,$header = FALSE,$parents = FALSE,$greptype = NULL, $search = NULL)
 {
 	$passedskip = $skip;
 	$passedcount = $count;
@@ -30,7 +30,7 @@
 		}
 	}
 
-	$revs = trim(git_rev_list($proj,$head, $passedcount, $passedskip, $header, $parents, $greptype, $search));
+	$revs = trim(git_rev_list($head, $passedcount, $passedskip, $header, $parents, $greptype, $search));
 	$revlist = explode("\n",$revs);
 
 	if ((!$canskip) && ($skip > 0)) {

--- a/include/gitutil.git_read_tag.php
+++ b/include/gitutil.git_read_tag.php
@@ -9,10 +9,10 @@
 
  require_once('gitutil.git_cat_file.php');
 
-function git_read_tag($project, $tag_id)
+function git_read_tag($tag_id)
 {
 	$tag = array();
-	$tagout = git_cat_file($project, $tag_id, NULL, "tag");
+	$tagout = git_cat_file($tag_id, NULL, "tag");
 	$tag['id'] = $tag_id;
 	$comment = array();
 	$tok = strtok($tagout,"\n");

--- a/include/gitutil.git_rev_list.php
+++ b/include/gitutil.git_rev_list.php
@@ -8,29 +8,38 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function git_rev_list($proj,$head,$count = NULL,$skip = NULL,$header = FALSE,$parents = FALSE,$greptype = NULL, $search = NULL)
+function git_rev_list($head,$count = NULL,$skip = NULL,$header = FALSE,$parents = FALSE,$greptype = NULL, $search = NULL)
 {
-	$cmd = GIT_REV_LIST . " ";
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return '';
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+
+	$args = array();
+
 	if ($header)
-		$cmd .= "--header ";
+		$args[] = '--header';
 	if ($parents)
-		$cmd .= "--parents ";
+		$args[] = '--parents';
 	if ($count)
-		$cmd .= "--max-count=" . $count . " ";
+		$args[] = '--max-count=' . $count;
 	if ($skip)
-		$cmd .= "--skip=" . $skip . " ";
+		$args[] = '--skip=' . $skip;
 	if ($greptype && $search) {
-		if ($greptype == "commit")
-			$cmd .= "--grep=" . $search . " ";
-		else if ($greptype == "author")
-			$cmd .= "--author=" . $search . " ";
-		else if ($greptype == "committer")
-			$cmd .= "--committer=" . $search . " ";
-		$cmd .= "--regexp-ignore-case ";
+		if ($greptype == 'commit')
+			$args[] = '--grep=\'' . $search . '\'';
+		else if ($greptype == 'author')
+			$args[] = '--author=\'' . $search . '\'';
+		else if ($greptype == 'committer')
+			$args[] = '--committer=\'' . $search . '\'';
+		$args[] = '--regexp-ignore-case';
 	}
-	return git_exec($proj, $cmd . " " . $head);
+	$args[] = $head;
+	return $exe->Execute(GIT_REV_LIST, $args);
 }
 
 ?>

--- a/include/gitutil.git_version.php
+++ b/include/gitutil.git_version.php
@@ -7,11 +7,14 @@
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  */
 
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
  function git_version()
  {
- 	$verstr = explode(" ",git_exec(null, "--version"));
+ 	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'));
+	$out = $exe->Execute('', array('--version'));
+
+ 	$verstr = explode(" ", $out);
 	if (($verstr[0] == "git") && ($verstr[1] == "version"))
 		return $verstr[2];
 	return null;

--- a/include/gitutil.read_info_ref.php
+++ b/include/gitutil.read_info_ref.php
@@ -8,14 +8,21 @@
  */
 
  require_once('defs.commands.php');
- require_once('gitutil.git_exec.php');
+ require_once(GITPHP_INCLUDEDIR . 'git/GitExe.class.php');
 
-function read_info_ref($project, $type = "")
+function read_info_ref($type = "")
 {
+	global $gitphp_current_project;
+
+	if (!$gitphp_current_project)
+		return;
+
+	$exe = new GitPHP_GitExe(GitPHP_Config::GetInstance()->GetValue('gitbin'), $gitphp_current_project);
+	
+	$showrefs = $exe->Execute(GIT_SHOW_REF, array('--dereference'));
+
+	$lines = explode("\n",$showrefs);
 	$refs = array();
-	$cmd = GIT_SHOW_REF . " --dereference";
-	$showrefs = git_exec($project, $cmd);
-	$lines = explode("\n",$showrefs);
 	foreach ($lines as $no => $line) {
 		if (preg_match("`^([0-9a-fA-F]{40}) .*" . $type . "/([^\^]+)`",$line,$regs)) {
 			if (isset($refs[$regs[1]]))

comments