Update git_describe() (#7402)
* Update `git_describe()` Add .git path check to avoid `fatal: not a git repository (or any of the parent directories): .git` printout * Update general.py
This commit is contained in:
1 parent
2da2466168
commit
014acde79d
1 file changed
+1
@@ -275,6 +275,7 @@ def check_online():
|
|||||||
def git_describe(path=ROOT): # path must be a directory
|
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
|
# Return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
|
||||||
try:
|
try:
|
||||||
|
assert (Path(path) / '.git').is_dir()
|
||||||
return check_output(f'git -C {path} describe --tags --long --always', shell=True).decode()[:-1]
|
return check_output(f'git -C {path} describe --tags --long --always', shell=True).decode()[:-1]
|
||||||
except Exception:
|
except Exception:
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Reference in new issue
Block a user