forked from LoneGazebo/Community-Patch-DLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_commit_id.bat
28 lines (22 loc) · 1021 Bytes
/
update_commit_id.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@echo off
SETLOCAL
set STATUS=Clean
for /f "usebackq delims=" %%i in (`git status --untracked-files^=no --porcelain`) do (
if [%%i] NEQ [] (
set STATUS=Dirty
echo Uncommitted change^(s^): %%i
)
)
if "%STATUS%" == "Clean" (echo Nothing to commit, working tree clean.)
for /f "usebackq delims=" %%i in (`git describe --abbrev^=0`) do set TAG=%%i
for /f "usebackq delims=" %%i in (`git rev-list --abbrev-commit -n 1 %TAG%`) do set TAGCOMMIT=%%i
for /f "usebackq delims=" %%i in (`git rev-list --abbrev-commit -n 1 HEAD`) do set HEADCOMMIT=%%i
if "%HEADCOMMIT%" == "%TAGCOMMIT%" (
echo const char CURRENT_GAMECORE_VERSION[] = "%TAG% %STATUS%"; //autogenerated, do not commit this file! > %~dp0%commit_id.inc
echo Version identifier will be "%TAG% %STATUS%"
)
if "%HEADCOMMIT%" NEQ "%TAGCOMMIT%" (
echo const char CURRENT_GAMECORE_VERSION[] = "%TAG% %HEADCOMMIT% %STATUS%"; //autogenerated, do not commit this file! > %~dp0%commit_id.inc
echo Version identifier will be "%TAG% %HEADCOMMIT% %STATUS%"
)
ENDLOCAL