Skip to content

Commit

Permalink
Only use GitVersioningSystem if we can find a .git folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie authored Mar 6, 2024
1 parent ff1c300 commit 16fbbf4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion codecov_cli/helpers/versioning_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def get_versioning_system() -> VersioningSystemInterface:
class GitVersioningSystem(VersioningSystemInterface):
@classmethod
def is_available(cls):
return which("git") is not None
if which("git") is not None:
p = subprocess.run(["git", "rev-parse", "--show-toplevel"], capture_output=True)
if p.stdout:
return True
return False

def get_fallback_value(self, fallback_field: FallbackFieldEnum):
if fallback_field == FallbackFieldEnum.commit_sha:
Expand Down

0 comments on commit 16fbbf4

Please sign in to comment.