From c56c4b334d80e9cc954cac5f087dd49f3a4f1066 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 11 Feb 2020 14:16:40 -0800 Subject: bugfix: `spack -V` should use `working_dir()` instead of `git -C` - `git -C` doesn't work on git before 1.8.5 - `working_dir` gets us the same effect --- lib/spack/spack/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 4386f50435..0821b4e699 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -22,6 +22,7 @@ import warnings from six import StringIO import llnl.util.cpu +import llnl.util.filesystem as fs import llnl.util.tty as tty import llnl.util.tty.color as color from llnl.util.tty.log import log_output @@ -125,8 +126,9 @@ def get_version(): if os.path.exists(git_path): git = exe.which("git") if git: - desc = git("-C", spack.paths.prefix, "describe", "--tags", - output=str, fail_on_error=False) + with fs.working_dir(spack.paths.prefix): + desc = git( + "describe", "--tags", output=str, fail_on_error=False) if git.returncode == 0: match = re.match(r"v([^-]+)-([^-]+)-g([a-f\d]+)", desc) -- cgit v1.2.3-60-g2f50