From ac7ad6b5193b215bd8bca03be78f8f20fedbe727 Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Sun, 26 Feb 2012 14:14:54 +0100 Subject: [PATCH] Bugfix for git version extraction code --- src/node/server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node/server.js b/src/node/server.js index ff7aba96f..c3be85ae4 100644 --- a/src/node/server.js +++ b/src/node/server.js @@ -30,14 +30,15 @@ var path = require('path'); require("./pluginfw/require"); // Load globals var plugins = require("./pluginfw/plugins"); var hooks = require("./pluginfw/hooks"); +var npm = require("npm/lib/npm.js"); //try to get the git version var version = ""; try { - var rootPath = path.normalize(__dirname + "/../") - var ref = fs.readFileSync(rootPath + ".git/HEAD", "utf-8"); - var refPath = rootPath + ".git/" + ref.substring(5, ref.indexOf("\n")); + var rootPath = path.resolve(npm.dir, '..'); + var ref = fs.readFileSync(rootPath + "/.git/HEAD", "utf-8"); + var refPath = rootPath + "/.git/" + ref.substring(5, ref.indexOf("\n")); version = fs.readFileSync(refPath, "utf-8"); version = version.substring(0, 7); console.log("Your Etherpad Lite git version is " + version);