diff --git a/config.ini-example b/config.ini-example index ce7571a..ea2c8da 100644 --- a/config.ini-example +++ b/config.ini-example @@ -2,12 +2,19 @@ client = '/usr/bin/git' ; Your git executable path repositories = '/var/www/projects/' ; Path to your repositories + +;Windows Users +;client = '"C:\Program Files (x86)\Git\bin\git.exe"' ; Your git executable path +;repositories = 'C:\Path\to\Repos\' ; Path to your repositories + + ; If you want to specify multiple paths, use the array syntax instead: ; ;repositories[] = '/var/www/projects/' ;repositories[] = '/var/www/subdir/more_projects/' ;repositories[] = '/home/user/even_more_projects/' + ; You can hide repositories from GitList, just copy this for each repository you want to hide ; hidden[] = '/var/www/projects/BetaTest' diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index 4c0cf91..321fe11 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -18,7 +18,7 @@ class Repository extends BaseRepository { $page = 15 * $page; $pager = "--skip=$page --max-count=15"; - $command = "log $pager --pretty=format:'%H%h%T%P%an%ae%at%cn%ce%ct'"; + $command = "log $pager --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\""; if ($file) { $command .= " $file"; @@ -37,7 +37,7 @@ class Repository extends BaseRepository public function searchCommitLog($query) { - $command = "log --grep='$query' --pretty=format:'%H%h%T%P%an%ae%at%cn%ce%ct'"; + $command = "log --grep='$query' --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\""; $logs = $this->getPrettyFormat($command); diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index 28724e8..ad6ce81 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -19,13 +19,20 @@ class Routing if ($regex === null) { $app = $this->app; + $self = $this; $quotedPaths = array_map( #function ($repo) use ($app) { # return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#'); #}, # TODO: return keys instead - function ($repo) use ($app) { - return $repo['name']; + + function ($repo) use ($app, $self) { + $repoName = $repo['name'] ; + //Windows + if ($self->OSIsWindows()){ + $repoName = str_replace('\\', '\\\\',$repoName); + } + return $repoName; }, $this->app['git']->getRepositories($this->app['git.repos']) ); @@ -35,6 +42,17 @@ class Routing return $regex; } + + public function OSIsWindows() + { + switch(PHP_OS){ + case 'WIN32': + case 'WINNT': + case 'Windows': return true; + default : return false; + } + + } /** * Strips the base path from a full repository path