Add platform specific exec functions
--- /dev/null
+++ b/include/gitutil.git_exec.php
@@ -1,1 +1,24 @@
+<?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')
+ include_once('gitutil.git_exec_win.php');
+ else
+ include_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);
+}
+
+?>
+
--- /dev/null
+++ b/include/gitutil.git_exec_nix.php
@@ -1,1 +1,18 @@
+<?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)
+ {
+ global $gitphp_conf;
+ $cmd = "env GIT_DIR=" . $project . " " . $gitphp_conf['gitbin'] . " " . $command;
+ return shell_exec($cmd);
+ }
+
+?>
+
--- /dev/null
+++ b/include/gitutil.git_exec_win.php
@@ -1,1 +1,18 @@
+<?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)
+{
+ global $gitphp_conf;
+ $cmd = "set GIT_DIR=" . $project . " && " . $gitphp_conf['gitbin'] . " " . $command;
+ return shell_exec($cmd);
+}
+
+?>
+