Skip to content

Commit

Permalink
impl: add a warning and env variable in the git commit grabber
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDevMinerTV committed Apr 30, 2023
1 parent 640720f commit 6c1b354
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/get_git_commit.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import subprocess
import os

revision = "00000000000000000000000000000000000000000"

if os.environ["GIT_REV"] != "":
revision = os.environ["GIT_REV"]

try:
revision = (
subprocess.check_output(["git", "rev-parse", "HEAD"])
.strip()
.decode("utf-8")
)
except:
pass
except Exception:
print("==========================================================================")
print(" WARNING: You are not in a Git repository or do not have Git installed.")
print(" The version string will be incorrect.")
print("==========================================================================")

print(f"'-DGIT_REV=\"{revision}\"'")

0 comments on commit 6c1b354

Please sign in to comment.