From 75e16cdc091bc9ba0b263f797291c1767f41b22a Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Wed, 10 Apr 2019 11:37:07 -0500 Subject: [PATCH] version: show when the release version is dirty - Silent stderr when calling `git describe` (fix #1866) --- dvc/version.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dvc/version.py b/dvc/version.py index 04ad18cb1..6edf8e20d 100644 --- a/dvc/version.py +++ b/dvc/version.py @@ -17,7 +17,7 @@ def _generate_version(base_version): if not _is_git_repo(pkg_dir) or not _have_git(): return base_version - if _is_release(pkg_dir, base_version): + if _is_release(pkg_dir, base_version) and not _is_dirty(pkg_dir): return base_version return "{base_version}+{short_sha}{dirty}".format( @@ -46,7 +46,9 @@ def _have_git(): def _is_release(dir_path, base_version): try: output = subprocess.check_output( - ["git", "describe", "--tags", "--exact-match"], cwd=dir_path + ["git", "describe", "--tags", "--exact-match"], + cwd=dir_path, + stderr=subprocess.STDOUT, ).decode("utf-8") tag = output.strip() return tag == base_version