diff --git a/Utilities/git-version-gen.cmd b/Utilities/git-version-gen.cmd index dc0096b85b..e705b049b3 100644 --- a/Utilities/git-version-gen.cmd +++ b/Utilities/git-version-gen.cmd @@ -69,14 +69,14 @@ if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH ( rem // Otherwise, GIT_BRANCH=branch set GIT_BRANCH=%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% ) - + rem // Make GIT_VERSION the last commit (shortened); Don't include commit count on non-master builds - for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%%I - + for /F %%I IN ('call %GIT% rev-parse --short^=8 HEAD') do set GIT_VERSION=%%I + ) else ( rem // Get last commit (shortened) and concat after commit count in GIT_VERSION - for /F %%I IN ('call %GIT% rev-parse --short HEAD') do set GIT_VERSION=%COMMIT_COUNT%-%%I - + for /F %%I IN ('call %GIT% rev-parse --short^=8 HEAD') do set GIT_VERSION=%COMMIT_COUNT%-%%I + for /F %%I IN ('call %GIT% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%I ) diff --git a/appveyor.yml b/appveyor.yml index a62808d973..33d65dc5ef 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ install: - ps: | # set env vars for versioning $env:COMM_TAG = $(git describe --tags $(git rev-list --tags --max-count=1)) $env:COMM_COUNT = $(git rev-list --count HEAD) - $env:COMM_HASH = $env:APPVEYOR_REPO_COMMIT.Substring(0,8) + $env:COMM_HASH = $(git rev-parse --short=8 HEAD) if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { $env:BUILD = "rpcs3-{0}-{1}_win64.7z" -f $env:COMM_TAG, $env:COMM_HASH diff --git a/rpcs3/git-version.cmake b/rpcs3/git-version.cmake index 1ac5874127..62123ca9dd 100644 --- a/rpcs3/git-version.cmake +++ b/rpcs3/git-version.cmake @@ -12,7 +12,7 @@ if(GIT_FOUND AND EXISTS "${SOURCE_DIR}/../.git/") if(NOT ${exit_code} EQUAL 0) message(WARNING "git rev-list failed, unable to include version.") endif() - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD WORKING_DIRECTORY ${SOURCE_DIR} RESULT_VARIABLE exit_code OUTPUT_VARIABLE GIT_VERSION_) @@ -49,7 +49,7 @@ if(EXISTS ${GIT_VERSION_FILE}) REGEX "${GIT_VERSION}") if(NOT "${match}" STREQUAL "") set(GIT_VERSION_UPDATE "0") - endif() + endif() endif() set(code_string "// This is a generated file.\n\n"