summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/gen_git_commit_h.sh
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/tdlib/td/gen_git_commit_h.sh')
-rw-r--r--protocols/Telegram/tdlib/td/gen_git_commit_h.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/protocols/Telegram/tdlib/td/gen_git_commit_h.sh b/protocols/Telegram/tdlib/td/gen_git_commit_h.sh
index b3416b2983..bc6bc2d352 100644
--- a/protocols/Telegram/tdlib/td/gen_git_commit_h.sh
+++ b/protocols/Telegram/tdlib/td/gen_git_commit_h.sh
@@ -1,7 +1,14 @@
#!/bin/sh
-commit=$(git rev-parse HEAD)
-git diff-index --quiet HEAD
-dirty=$?
+cd $(dirname $0)
+commit="$(git rev-parse HEAD 2> /dev/null)"
+commit="${commit:-unknown}"
+git diff-index --quiet HEAD 2> /dev/null
+if [ $? -ne 0 ]
+then
+ dirty="true"
+else
+ dirty="false"
+fi
printf "#pragma once\n#define GIT_COMMIT \"$commit\"\n#define GIT_DIRTY $dirty\n" > auto/git_info.h.new
if cmp -s auto/git_info.h.new auto/git_info.h 2>&1 > /dev/null
then