From e7e29197d5663209d5f464f861ea7052709a2b08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?=
 <skunk@xover.htu.tuwien.ac.at>
Date: Thu, 28 Dec 2017 10:29:33 +0100
Subject: [PATCH] repo.php: rename newestTimestamp(), info() includes timestamp

---
 repo.php              | 2 +-
 src/RepositoryDir.php | 4 +++-
 src/RepositoryGit.php | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/repo.php b/repo.php
index 7231a38e..18e1d46a 100644
--- a/repo.php
+++ b/repo.php
@@ -33,7 +33,7 @@ if (!array_key_exists($repoId, $allRepositories)) {
 $repo = getRepo($repoId, $allRepositories[$repoId]);
 
 $cacheDir = null;
-$ts = $repo->newestTimestamp($path);
+$ts = $repo->timestamp($path);
 if (isset($config['cache'])) {
   $cacheDir = "{$config['cache']}/repo";
   @mkdir($cacheDir);
diff --git a/src/RepositoryDir.php b/src/RepositoryDir.php
index bbf74918..e0d19208 100644
--- a/src/RepositoryDir.php
+++ b/src/RepositoryDir.php
@@ -14,10 +14,12 @@ class RepositoryDir {
       }
     }
 
+    $ret['timestamp'] = Date(DATE_ISO8601, $this->timestamp());
+
     return $ret;
   }
 
-  function newestTimestamp () {
+  function timestamp () {
     $ts = 0;
     $d = opendir($this->path);
     while ($f = readdir($d)) {
diff --git a/src/RepositoryGit.php b/src/RepositoryGit.php
index fa22857b..07130acf 100644
--- a/src/RepositoryGit.php
+++ b/src/RepositoryGit.php
@@ -14,10 +14,12 @@ class RepositoryGit {
       }
     }
 
+    $ret['timestamp'] = Date(DATE_ISO8601, $this->timestamp());
+
     return $ret;
   }
 
-  function newestTimestamp () {
+  function timestamp () {
     $ts = (int)shell_exec("cd " . escapeShellArg($this->path) . "; git log -1 --pretty=format:%ct");
 
     return $ts;