Skip to content

Commit

Permalink
Improve git command invocation (version number)
Browse files Browse the repository at this point in the history
Before, it was impossible to run individual test cases in PyCharm because of a path issue, we are now being more explicit.
  • Loading branch information
niconoe committed Nov 21, 2024
1 parent d8c0592 commit c20333a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dashboard/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import subprocess

from django.conf import settings


def readable_string(input_string: str) -> str:
"""Remove multiple whitespaces and \n to make a long string more readable"""
Expand All @@ -8,6 +10,8 @@ def readable_string(input_string: str) -> str:

def human_readable_git_version_number() -> str:
"""Return the git tag name (if available) or the git commit hash (if not)"""
project_root = settings.BASE_DIR

return subprocess.check_output(
["git", "describe", "--always", "--tags"], encoding="UTF-8"
["git", "-C", project_root, "describe", "--always", "--tags"], encoding="UTF-8"
).strip()

0 comments on commit c20333a

Please sign in to comment.