aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Repository.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-19 00:08:43 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-19 00:08:43 +0200
commit72dac890a041b8261262c7df7d7f8a8a816a146b (patch)
tree11b6d75b872f2816119250a5408dc95f88e60330 /src/phorkie/Repository.php
parentdca6d8d7b6bb61f303c17905dde4ecbde7ff1da5 (diff)
parent29035e26e880fcbc3027d5b6bd283959cb869534 (diff)
downloadphorkie-72dac890a041b8261262c7df7d7f8a8a816a146b.tar.gz
phorkie-72dac890a041b8261262c7df7d7f8a8a816a146b.zip
Merge branch 'auth-openid'
Diffstat (limited to 'src/phorkie/Repository.php')
-rw-r--r--src/phorkie/Repository.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php
index 46b2f65..43f2b23 100644
--- a/src/phorkie/Repository.php
+++ b/src/phorkie/Repository.php
@@ -32,6 +32,12 @@ class Repository
*/
public $hash;
+ /**
+ * Commit message of the last (or current) revision
+ *
+ * @var string
+ */
+ public $message;
/**
@@ -56,6 +62,7 @@ class Repository
$this->id = (int)$_GET['id'];
$this->loadDirs();
$this->loadHash();
+ $this->loadMessage();
}
protected function loadDirs()
@@ -97,6 +104,28 @@ class Repository
$this->hash = $output;
}
+ /**
+ * Populates $this->message
+ *
+ * @return void
+ */
+ public function loadMessage()
+ {
+ $rev = (isset($this->hash)) ? $this->hash : 'HEAD';
+ $output = $this->getVc()->getCommand('log')
+ ->setOption('oneline')
+ ->addArgument('-1')
+ ->addArgument($rev)
+ ->execute();
+ $output = trim($output);
+ if (strpos($output, ' ') > 0) {
+ $output = substr($output, strpos($output, ' '), strlen($output));
+ $this->message = trim($output);
+ } else {
+ $this->message = "This commit message intentionally left blank.";
+ }
+ }
+
public function loadById($id)
{
if (!is_numeric($id)) {