* Restore GIT_BRANCH
Removed by mistake on previous commit

* Fix commit count on AppVeyor builds
This commit is contained in:
Ani 2017-12-08 23:53:05 +00:00 committed by GitHub
parent 6b323d7e2e
commit 60f5929f81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 17 deletions

View file

@ -19,20 +19,13 @@ if(GIT_FOUND AND EXISTS "${SOURCE_DIR}/../.git/")
if(NOT ${exit_code} EQUAL 0)
message(WARNING "git rev-parse failed, unable to include version.")
endif()
# (Unused code, we're currently building with MSVC on AppVeyor)
# Hack fix for AppVeyor (Pull Requests don't generate a branch name)
#
# if(NOT DEFINED ENV{APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH})
# execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
# WORKING_DIRECTORY ${SOURCE_DIR}
# RESULT_VARIABLE exit_code
# OUTPUT_VARIABLE GIT_BRANCH)
# if(NOT ${exit_code} EQUAL 0)
# message(WARNING "git rev-parse failed, unable to include git branch.")
# endif()
# else()
# set(GIT_BRANCH $ENV{APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH})
# endif()
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE GIT_BRANCH)
if(NOT ${exit_code} EQUAL 0)
message(WARNING "git rev-parse failed, unable to include git branch.")
endif()
string(STRIP ${GIT_VERSION} GIT_VERSION)
string(STRIP ${GIT_VERSION_} GIT_VERSION_)
string(STRIP ${GIT_VERSION}-${GIT_VERSION_} GIT_VERSION)