summaryrefslogtreecommitdiffstats
path: root/printHash.bat
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2021-02-12 16:15:51 +0100
committerGitHub <noreply@github.com>2021-02-12 16:15:51 +0100
commita44d7d86cb66ff584eb497ec1efb70d11d58288d (patch)
treec4e99fefd4af077dfe7a7479978d013cf14f6ff6 /printHash.bat
parentUpdate TXDs (diff)
parentFix sha1 on premake linux (diff)
downloadre3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.gz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.bz2
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.lz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.xz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.zst
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.zip
Diffstat (limited to '')
-rw-r--r--printHash.bat26
1 files changed, 26 insertions, 0 deletions
diff --git a/printHash.bat b/printHash.bat
new file mode 100644
index 00000000..ef1cd9d6
--- /dev/null
+++ b/printHash.bat
@@ -0,0 +1,26 @@
+@echo off
+
+REM creates version.h with HEAD commit hash
+REM params: $1=full path to output file (usually points version.h)
+
+setlocal enableextensions enabledelayedexpansion
+
+cd /d "%~dp0"
+
+break> %1
+
+<nul set /p=^"#define GIT_SHA1 ^"^"> %1
+
+where git
+if "%errorlevel%" == "0" ( goto :havegit ) else ( goto :writeending )
+
+:havegit
+for /f %%v in ('git rev-parse --short HEAD') do set version=%%v
+<nul set /p="%version%" >> %1
+
+:writeending
+
+echo ^" >> %1
+echo const char* g_GIT_SHA1 = GIT_SHA1; >> %1
+
+EXIT /B \ No newline at end of file