Skip to content

Commit

Permalink
fix: make commit grabber use GIT_REV env var if set
Browse files Browse the repository at this point in the history
Co-authored-by: nekomona <nekomona@163.com>
  • Loading branch information
TheDevMinerTV and nekomona authored Jul 5, 2023
1 parent 1ad5d72 commit 594d3c0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions scripts/get_git_commit.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import subprocess
import os

revision = "00000000000000000000000000000000000000000"
revision = ""

env_rev = os.environ.get("GIT_REV")
if env_rev != "":
if not env_rev is None and env_rev != "":
revision = env_rev

try:
revision = (
subprocess.check_output(["git", "rev-parse", "HEAD"])
.strip()
.decode("utf-8")
)
except Exception:
revision = "NOT_GIT"
else:
try:
revision = (
subprocess.check_output(["git", "rev-parse", "HEAD"])
.strip()
.decode("utf-8")
)
except Exception:
revision = "NOT_GIT"

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

0 comments on commit 594d3c0

Please sign in to comment.