Avoid duplicating license many times
[gitphp.git] / include / gitutil.git_ls_tree.php
blob:a/include/gitutil.git_ls_tree.php -> blob:b/include/gitutil.git_ls_tree.php
--- a/include/gitutil.git_ls_tree.php
+++ b/include/gitutil.git_ls_tree.php
@@ -7,15 +7,17 @@
  *  Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
  */
 
- include_once('defs.commands.php');
+ require_once('defs.commands.php');
+ require_once('gitutil.git_exec.php');
 
-function git_ls_tree($proj,$hash,$nullterm = FALSE)
+function git_ls_tree($proj,$hash,$nullterm = FALSE, $recurse = FALSE)
 {
-	global $gitphp_conf;
-	$cmd = "env GIT_DIR=" . $proj . " " . $gitphp_conf['gitbin'] . GIT_LS_TREE;
+	$cmd = GIT_LS_TREE;
 	if ($nullterm)
 		$cmd .= " -z";
-	return shell_exec($cmd . " " . $hash);
+	if ($recurse)
+		$cmd .= " -r -t --full-name";
+	return git_exec($proj, $cmd . " " . $hash);
 }
 
 ?>

comments