Dont expand user for metric path value

This makes the metrics report cleanly when the same users home
directory differs across machines.

BUG=chromium:708355
TEST=Run tests

Change-Id: I795c9f45d769d1f25df057e6b42fdd08157cef66
Reviewed-on: https://chromium-review.googlesource.com/473494
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
diff --git a/scripts/sysmon/git_metrics.py b/scripts/sysmon/git_metrics.py
index a387e2a..de0f53a 100644
--- a/scripts/sysmon/git_metrics.py
+++ b/scripts/sysmon/git_metrics.py
@@ -41,7 +41,13 @@
 
 
 class _GitMetricCollector(object):
-  """Class for collecting metrics about a git repository."""
+  """Class for collecting metrics about a git repository.
+
+  The constructor takes the arguments: `gitdir`, `metric_path`.
+  `gitdir` is the path to the Git directory to collect metrics for and
+  may start with a tilde (expanded to a user's home directory).
+  `metric_path` is the Monarch metric path to report to.
+  """
 
   _commit_hash_metric = ts_mon.StringMetric(
       'git/hash',
@@ -53,7 +59,7 @@
 
   def __init__(self, gitdir, metric_path):
     self._gitdir = gitdir
-    self._gitrepo = _GitRepo(gitdir)
+    self._gitrepo = _GitRepo(os.path.expanduser(gitdir))
     self._fields = {'repo': gitdir}
     self._metric_path = metric_path
 
@@ -78,7 +84,7 @@
     self._timestamp_metric.set(commit_time, self._fields)
 
 
-_CHROMIUMOS_DIR = os.path.expanduser('~chromeos-test/chromiumos/')
+_CHROMIUMOS_DIR = '~chromeos-test/chromiumos/'
 
 _repo_collectors = (
     # TODO(ayatane): We cannot access chromeos-admin because we are