Don't load tag data if we want the commit and it's already been set
Don't load tag data if we want the commit and it's already been set

--- a/include/git/Tag.class.php
+++ b/include/git/Tag.class.php
@@ -158,14 +158,17 @@
 	 */
 	public function GetCommit()
 	{
-		if (!$this->dataRead)
-			$this->ReadData();
-
 		if ($this->commitReferenced)
 			$this->DereferenceCommit();
 
 		if (!$this->commit)
 			$this->ReadCommit();
+
+		if ($this->commit)
+			return $this->commit;
+
+		if (!$this->dataRead)
+			$this->ReadData();
 
 		return $this->commit;
 	}

comments