Move blob size loading to strategy
[gitphp.git] / include / git / blob / BlobLoad_Git.class.php
blob:a/include/git/blob/BlobLoad_Git.class.php -> blob:b/include/git/blob/BlobLoad_Git.class.php
--- a/include/git/blob/BlobLoad_Git.class.php
+++ b/include/git/blob/BlobLoad_Git.class.php
@@ -46,5 +46,23 @@
 
 		return $this->exe->Execute($blob->GetProject()->GetPath(), GIT_CAT_FILE, $args);
 	}
+
+	/**
+	 * Gets the size of a blob
+	 *
+	 * @param GitPHP_Blob $blob blob
+	 * @return int blob size
+	 */
+	public function Size($blob)
+	{
+		if (!$blob)
+			return;
+
+		$args = array();
+		$args[] = '-s';
+		$args[] = $blob->GetHash();
+
+		return $this->exe->Execute($blob->GetProject()->GetPath(), GIT_CAT_FILE, $args);
+	}
 }
 

comments