try_git_describe: Set cwd, not --git-dir.

git describe --dirty requires a working tree, not just a repository.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2019-02-28 21:14:54 +00:00 committed by Tim Abbott
parent 9962377018
commit 88e90d34b9
1 changed files with 2 additions and 3 deletions

View File

@ -18,10 +18,9 @@ from version import ZULIP_VERSION
def try_git_describe() -> Optional[str]:
try: # nocoverage
return subprocess.check_output(
['git',
'--git-dir', os.path.join(os.path.dirname(__file__), '../.git'),
'describe', '--tags', '--always', '--dirty', '--long'],
['git', 'describe', '--tags', '--always', '--dirty', '--long'],
stderr=subprocess.PIPE,
cwd=os.path.join(os.path.dirname(__file__), '..'),
).strip().decode('utf-8')
except Exception: # nocoverage
return None