Skip to content

Commit

Permalink
added switch "bare" for bare repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre (Server) committed Nov 26, 2010
1 parent 682344a commit 6907182
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions git-utils.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
{
Expand Down
6 changes: 5 additions & 1 deletion syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '<ul class="dokugitviewer">';
foreach($log as $row)
{
Expand Down

0 comments on commit 6907182

Please sign in to comment.