Skip to content

Commit d6dd417

Browse files
Improve commit hash retrieval in dynamic version function
1 parent 25be8d8 commit d6dd417

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/sdialog/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
def _get_dynamic_version() -> str:
4343
""" Retrieves the current version of the package, appending the current git commit hash if available."""
4444
try:
45-
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode("utf-8")
45+
commit_hash = subprocess.check_output(
46+
["git", "rev-parse", "HEAD"],
47+
stderr=subprocess.DEVNULL,
48+
).strip().decode("utf-8")
4649
# If not a valid commit hash, set to empty string
4750
if re.match(r"\b[0-9a-f]{5,40}\b", commit_hash):
4851
return f"{__version__}+{commit_hash}"

0 commit comments

Comments
 (0)