2017-03-08 01:41:21 +00:00
|
|
|
@echo off
|
|
|
|
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse HEAD`) DO (
|
|
|
|
SET GIT_COMMIT_HASH=%%F
|
|
|
|
)
|
2023-11-11 00:21:33 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --short HEAD`) DO (
|
|
|
|
SET GIT_COMMIT_HASH_SHORT=%%F
|
|
|
|
)
|
2017-03-08 01:41:21 +00:00
|
|
|
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --abbrev-ref HEAD`) DO (
|
|
|
|
SET GIT_BRANCH_NAME=%%F
|
|
|
|
)
|
|
|
|
:: We create the file in one go to avoid doubled lines in multi-threaded builds.
|
2023-11-11 00:21:33 +00:00
|
|
|
(echo #define GIT_COMMIT ^"%GIT_COMMIT_HASH%^" && echo #define GIT_COMMIT_SHORT ^"%GIT_COMMIT_HASH_SHORT%^" && echo #define GIT_BRANCH ^"%GIT_BRANCH_NAME%^")>%1
|