From 6907182aed669b649e5f5698384fbd760250b21e Mon Sep 17 00:00:00 2001 From: "Andre (Server)" Date: Fri, 26 Nov 2010 17:21:07 +0100 Subject: [PATCH] added switch "bare" for bare repositories --- git-utils.inc.php | 10 ++++++---- syntax.php | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/git-utils.inc.php b/git-utils.inc.php index 90f5fdc..5eaf551 100644 --- a/git-utils.inc.php +++ b/git-utils.inc.php @@ -2,14 +2,16 @@ require_once('config.inc.php'); -function run_git($command, $repo) +function run_git($command, $repo, $bare=false) { $repo = str_replace('/', '', $repo); $repo = str_replace('\\', '', $repo); + if (!$bare) + $repo.='/.git'; $output = array(); $ret = 0; - $c = GIT_EXEC.' --git-dir='.ROOT_DIR.$repo.'/ '.$command; + $c = GIT_EXEC.' --git-dir='.ROOT_DIR.$repo.' '.$command; exec($c, $output, $ret); if ($ret != 0) { //debug @@ -19,11 +21,11 @@ function run_git($command, $repo) return $output; } -function git_get_log($repo, $limit = 10) +function git_get_log($repo, $limit = 10, $bare=false) { $format = array('%H', '%at', '%an', '%s'); $params = implode(DELIMETER, $format); - $data = run_git('log --pretty=format:"'.$params.'" -'.$limit, $repo); + $data = run_git('log --pretty=format:"'.$params.'" -'.$limit, $repo, $bare); $result = array(); foreach($data as $line) { diff --git a/syntax.php b/syntax.php index a609af1..8122eaa 100644 --- a/syntax.php +++ b/syntax.php @@ -63,7 +63,11 @@ function render($mode, &$renderer, $data) { $limit = (int)($data['limit']); else $limit = 10; - $log = git_get_log($data['repository'], $limit); + if (empty($data['bare'])) + $bare=false; + else + $bare=true; + $log = git_get_log($data['repository'], $limit,$bare); $renderer->doc .= '