Merge pull request #2 from tobya/WindowsMulti

Windows multi
This commit is contained in:
wimrijnders
2012-12-31 01:28:28 -08:00
3 changed files with 29 additions and 4 deletions

View File

@@ -2,12 +2,19 @@
client = '/usr/bin/git' ; Your git executable path client = '/usr/bin/git' ; Your git executable path
repositories = '/var/www/projects/' ; Path to your repositories 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: ; If you want to specify multiple paths, use the array syntax instead:
; ;
;repositories[] = '/var/www/projects/' ;repositories[] = '/var/www/projects/'
;repositories[] = '/var/www/subdir/more_projects/' ;repositories[] = '/var/www/subdir/more_projects/'
;repositories[] = '/home/user/even_more_projects/' ;repositories[] = '/home/user/even_more_projects/'
; You can hide repositories from GitList, just copy this for each repository you want to hide ; You can hide repositories from GitList, just copy this for each repository you want to hide
; hidden[] = '/var/www/projects/BetaTest' ; hidden[] = '/var/www/projects/BetaTest'

View File

@@ -18,7 +18,7 @@ class Repository extends BaseRepository
{ {
$page = 15 * $page; $page = 15 * $page;
$pager = "--skip=$page --max-count=15"; $pager = "--skip=$page --max-count=15";
$command = "log $pager --pretty=format:'<item><hash>%H</hash><short_hash>%h</short_hash><tree>%T</tree><parent>%P</parent><author>%an</author><author_email>%ae</author_email><date>%at</date><commiter>%cn</commiter><commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date><message><![CDATA[%s]]></message></item>'"; $command = "log $pager --pretty=format:\"<item><hash>%H</hash><short_hash>%h</short_hash><tree>%T</tree><parent>%P</parent><author>%an</author><author_email>%ae</author_email><date>%at</date><commiter>%cn</commiter><commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date><message><![CDATA[%s]]></message></item>\"";
if ($file) { if ($file) {
$command .= " $file"; $command .= " $file";
@@ -37,7 +37,7 @@ class Repository extends BaseRepository
public function searchCommitLog($query) public function searchCommitLog($query)
{ {
$command = "log --grep='$query' --pretty=format:'<item><hash>%H</hash><short_hash>%h</short_hash><tree>%T</tree><parent>%P</parent><author>%an</author><author_email>%ae</author_email><date>%at</date><commiter>%cn</commiter><commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date><message><![CDATA[%s]]></message></item>'"; $command = "log --grep='$query' --pretty=format:\"<item><hash>%H</hash><short_hash>%h</short_hash><tree>%T</tree><parent>%P</parent><author>%an</author><author_email>%ae</author_email><date>%at</date><commiter>%cn</commiter><commiter_email>%ce</commiter_email><commiter_date>%ct</commiter_date><message><![CDATA[%s]]></message></item>\"";
$logs = $this->getPrettyFormat($command); $logs = $this->getPrettyFormat($command);

View File

@@ -19,13 +19,20 @@ class Routing
if ($regex === null) { if ($regex === null) {
$app = $this->app; $app = $this->app;
$self = $this;
$quotedPaths = array_map( $quotedPaths = array_map(
#function ($repo) use ($app) { #function ($repo) use ($app) {
# return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#'); # return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#');
#}, #},
# TODO: return keys instead # 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']) $this->app['git']->getRepositories($this->app['git.repos'])
); );
@@ -35,6 +42,17 @@ class Routing
return $regex; 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 * Strips the base path from a full repository path