Inject dependent classes into project class
[gitphp.git] / include / git / projectlist / ProjectListBase.class.php
blob:a/include/git/projectlist/ProjectListBase.class.php -> blob:b/include/git/projectlist/ProjectListBase.class.php
--- a/include/git/projectlist/ProjectListBase.class.php
+++ b/include/git/projectlist/ProjectListBase.class.php
@@ -210,8 +210,6 @@
 	{
 		$project = new GitPHP_Project(GitPHP_Util::AddSlash($this->projectRoot), $proj);
 
-		$this->InjectProjectDependencies($project);
-
 		$this->ApplyGlobalConfig($project);
 
 		$this->ApplyGitConfig($project);
@@ -220,6 +218,8 @@
 			$this->ApplyProjectSettings($project, $this->projectSettings[$proj]);
 		}
 
+		$this->InjectProjectDependencies($project);
+
 		return $project;
 	}
 
@@ -233,13 +233,29 @@
 		if (!$project)
 			return;
 
+		$compat = $project->GetCompat();
+
+		$headList = new GitPHP_HeadList($project);
+		$headList->SetCompat($compat);
+		$project->SetHeadList($headList);
+
+		$tagList = new GitPHP_TagList($project);
+		$tagList->SetCompat($compat);
+		$project->SetTagList($tagList);
+
+		if (!$compat) {
+			$loader = new GitPHP_GitObjectLoader($project);
+			$project->SetObjectLoader($loader);
+		}
+
+		$manager = new GitPHP_GitObjectManager($project);
 		if ($this->memoryCache) {
-			$project->GetObjectManager()->SetMemoryCache($this->memoryCache);
-		}
-
+			$manager->SetMemoryCache($this->memoryCache);
+		}
 		if ($this->cache) {
-			$project->GetObjectManager()->SetCache($this->cache);
-		}
+			$manager->SetCache($this->cache);
+		}
+		$project->SetObjectManager($manager);
 	}
 
 	/**

comments