Skip to content

Commit 659df9b

Browse files
authored
Merge pull request #409 from simvue-io/hotfix/handle-no-git
Handle case where git is not installed
2 parents 7ee5774 + 61c05be commit 659df9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

simvue/metadata.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"""
88

99
import typing
10-
import git
1110
import json
1211

1312

@@ -28,6 +27,11 @@ def git_info(repository: str) -> dict[str, typing.Any]:
2827
dict[str, typing.Any]
2928
metadata for the target repository
3029
"""
30+
try:
31+
import git
32+
except ImportError:
33+
return {}
34+
3135
try:
3236
git_repo = git.Repo(repository, search_parent_directories=True)
3337
current_commit: git.Commit = git_repo.head.commit

0 commit comments

Comments
 (0)