Fix buildinfo hash for cases there's no upstream set for the branch

This commit is contained in:
Sergey Sharybin 2013-11-28 02:25:09 +06:00
parent 1d2c4357d5
commit af7a2a3b6a
2 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,15 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (MY_WC_HASH STREQUAL "")
# Local branch, not set to upstream.
# Well, let's use HEAD for now
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
execute_process(COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_BRANCH

View File

@ -422,6 +422,9 @@ def buildinfo(lenv, build_type):
build_hash = os.popen('git rev-parse --short @{u}').read().strip()
build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
if build_hash == '':
build_hash = os.popen('git rev-parse --short HEAD').read().strip()
# ## Check for local modifications
has_local_changes = False