Permalink
Browse files

Git::lsTree()

  • Loading branch information...
1 parent c210691 commit d38e4af91a7dde03437288de1ddd7866e6c5ea98 @josegonzalez josegonzalez committed Oct 20, 2010
Showing with 18 additions and 3 deletions.
  1. +18 −3 libs/git.php
View
@@ -135,13 +135,28 @@ public static function commit($config, $proj, $commit) {
return self::getLastNCommits($config, $proj, $options);
}
+ public static function lsTree($config, $proj, $tree) {
+ $out = array();
+ //Have to strip the \t between hash and file
+ $cmd = "GIT_DIR=" . self::$repos[$proj] . $config['repo_suffix'] . " {$config['git_binary']} ls-tree " . $tree . " 2>&1 | sed -e 's/\t/ /g'";
+
+ exec($cmd, &$out);
+
+ $results = array();
+ foreach ($out as $line) {
+ $results[] = array_combine(
+ array('perm', 'type', 'hash', 'file'),
+ explode(" ", $line, 4)
+ );
+ }
+ return $results;
+ }
+
public static function diff($config, $proj, $commit) {
$out = array();
$cmd = "GIT_DIR=" . self::$repos[$proj] . $config['repo_suffix'] . " {$config['git_binary']} show {$commit} --format=\"%b\" 2>&1";
exec($cmd, &$out);
- //$out = htmlentities(implode("\n", $out));
- //$out = explode('\n', $out);
-
+
$diff = false;
$summary = array();
$file = array();

0 comments on commit d38e4af

Please sign in to comment.