Skip to content

Commit

Permalink
fix getRepository logic
Browse files Browse the repository at this point in the history
verify with isset instead of empty, because we only have a minimal repo
loaded(repo_id, vcs and name); so we have to retrieve the complete object when
needed.

to retrieve we have to use getRepositories instead of a non-set
base_info(probably a copy/paste made it)
  • Loading branch information
marvil07 committed Jul 22, 2009
1 parent 7ea30b8 commit 7cec0b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/classes.inc
Expand Up @@ -46,12 +46,12 @@ final class VersioncontrolRepositoryCache {
* If no repository corresponds to the given repository id, NULL is returned.
*/
public function getRepository($repo_id) {
if (empty($this->repoCache['repo_id'][$repo_id])) {
if (!isset($this->repoCache['repo_id'][$repo_id])) {
// no such repo. bail out.
return;
}
if (!$this->repoCache['repo_id'][$repo_id] instanceof VersioncontrolRepository) {
$this->cacheRepository(new $this->backends[$this->repoCache['repo_id'][$repo_id]->vcs]['classes']['repo']($base_info));
$this->cacheRepository(array_shift($this->getRepositories(array('repo_id' => $repo_id))));
}
return $this->repoCache['repo_id'][$repo_id];
}
Expand Down

0 comments on commit 7cec0b2

Please sign in to comment.