Commit e1e485a9 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #268 in ZP/z-push from feature/ZP-950-improve-git-version-logging to develop

* commit '1ee21f08':
  ZP-950 Changed method to determine ZP_VERSION so it contains the branch, tag, offset and commit id, fixed access description.
parents 7f80c019 1ee21f08
...@@ -1296,11 +1296,11 @@ class TimezoneUtil { ...@@ -1296,11 +1296,11 @@ class TimezoneUtil {
} }
/** /**
* Pack timezone info for Sync * Pack timezone info for Sync.
* *
* @param array $tz * @param array $tz
* *
* @access private * @access public
* @return string * @return string
*/ */
static public function GetSyncBlobFromTZ($tz) { static public function GetSyncBlobFromTZ($tz) {
......
...@@ -42,9 +42,11 @@ ...@@ -42,9 +42,11 @@
************************************************/ ************************************************/
if (!defined("ZPUSH_VERSION")) { if (!defined("ZPUSH_VERSION")) {
$commit = exec("type git && git log --date=short --pretty=format:'%h/%ad' -1"); $path = escapeshellarg(dirname(realpath($_SERVER['SCRIPT_FILENAME'])));
if(preg_match("/^[\da-f]+\/\d{4}-\d{2}-\d{2}$/i", $commit)) { $branch = trim(exec("hash git && cd $path >/dev/null 2>&1 && git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e \"s/* \(.*\)/\\1/\""));
define("ZPUSH_VERSION", "GIT " . $commit); $version = exec("hash git && cd $path >/dev/null 2>&1 && git describe --always &2>/dev/null");
if ($branch && $version) {
define("ZPUSH_VERSION", $branch .'-'. $version);
} }
else { else {
define("ZPUSH_VERSION", "GIT"); define("ZPUSH_VERSION", "GIT");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment