aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/File.php2
-rw-r--r--src/phorkie/GitCommandBinary.php2
-rw-r--r--src/phorkie/HtmlHelper.php2
-rw-r--r--src/phorkie/Repository.php29
-rw-r--r--src/phorkie/Repository/Commit.php2
-rw-r--r--src/phorkie/Repository/Post.php20
-rw-r--r--src/phorkie/Tool/Manager.php2
-rw-r--r--src/phorkie/Tool/Result.php2
-rw-r--r--src/phorkie/Tool/Result/Line.php2
-rw-r--r--src/phorkie/Tools.php2
10 files changed, 53 insertions, 12 deletions
diff --git a/src/phorkie/File.php b/src/phorkie/File.php
index 331f2e5..f378f60 100644
--- a/src/phorkie/File.php
+++ b/src/phorkie/File.php
@@ -165,4 +165,4 @@ class File
}
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/GitCommandBinary.php b/src/phorkie/GitCommandBinary.php
index 13a31db..a005349 100644
--- a/src/phorkie/GitCommandBinary.php
+++ b/src/phorkie/GitCommandBinary.php
@@ -12,4 +12,4 @@ class GitCommandBinary extends \VersionControl_Git_Util_Command
}
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php
index af046cf..ea21ab5 100644
--- a/src/phorkie/HtmlHelper.php
+++ b/src/phorkie/HtmlHelper.php
@@ -25,4 +25,4 @@ class HtmlHelper
}
}
-?> \ No newline at end of file
+?>
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)) {
diff --git a/src/phorkie/Repository/Commit.php b/src/phorkie/Repository/Commit.php
index 05c988b..62f1d40 100644
--- a/src/phorkie/Repository/Commit.php
+++ b/src/phorkie/Repository/Commit.php
@@ -70,4 +70,4 @@ class Repository_Commit
}
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php
index de987e0..9119e06 100644
--- a/src/phorkie/Repository/Post.php
+++ b/src/phorkie/Repository/Post.php
@@ -15,7 +15,7 @@ class Repository_Post
*
* @return boolean True if the post was successful
*/
- public function process($postData)
+ public function process($postData, $sessionData)
{
if (!isset($postData['files'])) {
return false;
@@ -117,11 +117,23 @@ class Repository_Post
}
}
+ $commitmsg = "phorkie commit";
+
+ if (isset($sessionData['identity'])) {
+ $notes = $sessionData['identity'];
+ } else {
+ $notes = $sessionData['ipaddr'];
+ }
+
if ($bCommit) {
$vc->getCommand('commit')
- ->setOption('message', '')
- ->setOption('allow-empty-message')
- ->setOption('author', 'Anonymous <anonymous@phorkie>')
+ ->setOption('message', $commitmsg)
+ ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>')
+ ->execute();
+ //FIXME: git needs ref BEFORE add. ideally VersionControl_Git needs to be updated
+ $vc->getCommand('notes --ref=identity add')
+ ->setOption('force')
+ ->setOption('message', "$notes")
->execute();
$bChanged = true;
}
diff --git a/src/phorkie/Tool/Manager.php b/src/phorkie/Tool/Manager.php
index 8e18199..ca93b4a 100644
--- a/src/phorkie/Tool/Manager.php
+++ b/src/phorkie/Tool/Manager.php
@@ -43,4 +43,4 @@ class Tool_Manager
}
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/Tool/Result.php b/src/phorkie/Tool/Result.php
index 22ea273..94dfe5e 100644
--- a/src/phorkie/Tool/Result.php
+++ b/src/phorkie/Tool/Result.php
@@ -6,4 +6,4 @@ class Tool_Result
public $annotations;
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/Tool/Result/Line.php b/src/phorkie/Tool/Result/Line.php
index a788db6..1fa8bcb 100644
--- a/src/phorkie/Tool/Result/Line.php
+++ b/src/phorkie/Tool/Result/Line.php
@@ -31,4 +31,4 @@ class Tool_Result_Line
}
}
-?> \ No newline at end of file
+?>
diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php
index 843b2df..e4aab63 100644
--- a/src/phorkie/Tools.php
+++ b/src/phorkie/Tools.php
@@ -62,4 +62,4 @@ class Tools
}
-?> \ No newline at end of file
+?>