From 22b35107e90d17563c6662c5878c129309f5a7f7 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 12 Apr 2022 17:14:18 +0200 Subject: [PATCH 1/2] Update `git_describe()` Add .git path check to avoid `fatal: not a git repository (or any of the parent directories): .git` printout --- utils/general.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/general.py b/utils/general.py index 6c2558db74c4..c09e5ca8f921 100755 --- a/utils/general.py +++ b/utils/general.py @@ -275,6 +275,7 @@ def check_online(): def git_describe(path=ROOT): # path must be a directory # Return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe try: + assert Path(path / '.git').is_dir() return check_output(f'git -C {path} describe --tags --long --always', shell=True).decode()[:-1] except Exception: return '' From 8db1dcf0fb8d5faa932bb788333b5d9287b2cd52 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 12 Apr 2022 17:16:43 +0200 Subject: [PATCH 2/2] Update general.py --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index c09e5ca8f921..daef2a427111 100755 --- a/utils/general.py +++ b/utils/general.py @@ -275,7 +275,7 @@ def check_online(): def git_describe(path=ROOT): # path must be a directory # Return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe try: - assert Path(path / '.git').is_dir() + assert (Path(path) / '.git').is_dir() return check_output(f'git -C {path} describe --tags --long --always', shell=True).decode()[:-1] except Exception: return ''