From 3a49a77c07e13919b24822c571297a5b747cc979 Mon Sep 17 00:00:00 2001 From: Zion Date: Tue, 7 Nov 2017 17:22:41 -0800 Subject: [PATCH] Fix git-branch in title... again (#3704) Fix git-branch in title... again --- Utilities/git-version-gen.cmd | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Utilities/git-version-gen.cmd b/Utilities/git-version-gen.cmd index c59dd69518..f9155c26ca 100644 --- a/Utilities/git-version-gen.cmd +++ b/Utilities/git-version-gen.cmd @@ -16,6 +16,7 @@ rem // Official git repository and contact information can be found at rem // https://github.com/RPCS3/rpcs3 and http://rpcs3.net/. setlocal ENABLEDELAYEDEXPANSION +setlocal ENABLEEXTENSIONS set GIT_VERSION_FILE=%~p0..\rpcs3\git-version.h if not defined GIT ( @@ -56,7 +57,17 @@ if errorlevel 1 ( for /F %%I IN ('call %GIT% rev-list HEAD --count') do set GIT_VERSION=%%I for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%GIT_VERSION%-%%I -for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%I +if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH ( + if "%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%"=="master" ( + for /f "tokens=1* delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set user=%%a + set "GIT_BRANCH=!user!/%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" + ) else ( + set GIT_BRANCH=%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% + ) + +) else ( + for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%I +) rem // Don't modify the file if it already has the current version. if exist "%GIT_VERSION_FILE%" ( @@ -69,7 +80,7 @@ if exist "%GIT_VERSION_FILE%" ( echo // This is a generated file. > "%GIT_VERSION_FILE%" echo. >> "%GIT_VERSION_FILE%" echo #define RPCS3_GIT_VERSION "%GIT_VERSION%" >> "%GIT_VERSION_FILE%" -echo #define RPCS3_GIT_BRANCH "%GIT_BRANCH%" >> "%GIT_VERSION_FILE%" +echo #define RPCS3_GIT_BRANCH ^"%GIT_BRANCH%^" >> "%GIT_VERSION_FILE%" echo. >> "%GIT_VERSION_FILE%" echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%" echo #define RPCS3_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%"