Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
add retro compatibility for config and explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanAntony committed Oct 9, 2013
1 parent a4ca315 commit 9a39bfb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions config.example.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?php
/**
* Repositories path is an array of ('repo name'=> 'repo path')
* In this case the repo is in the same folder than the git-pretty-stats
* More flexible than the repositories folder
* In this case the repos are in the same folder than the git-pretty-stats
* More flexible than the repositories folder
* Old system still working :
* return array(
* 'repositoriesPath' => 'repositories'
* );
**/
return array(
'repositoriesPath' => array(
'repo-name'=>'../repo-path',
'repo-name2'=>'../repo-path2',
'repo-name3'=>'../repo-path3'
'repo-name' => '../repo-path',
'repo-name2' => '../repo-path2',
'repo-name3' => '../repo-path3'
)
);
?>
4 changes: 4 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@

function loadRepository ($app, $path) {
$repositoryPath = $app['config']['repositoriesPath'][$path];
//trying the old-fashioned way for compatibility
if( !realpath($repositoryPath) ){
$repositoryPath = $app['config']['repositoriesPath'] . '/' . $path;
}
try {
$gitWrapper = new \PHPGit_Repository(__DIR__ . '/' . $repositoryPath);
$repository = new Repository($gitWrapper);
Expand Down

0 comments on commit 9a39bfb

Please sign in to comment.