Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-09-22 16:00:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-09-22 16:02:52 +0300
commitd32ae028ba1e345bf853fdbd698a62cf7067267a (patch)
tree49aa78377be442d7bc2b1a593d134a779ce20acd /build_files
parent42f42cbfdce1732b193c05495eab4f23ddba045d (diff)
Buildinfo: Improve behavior with detached HEAD
Try real hard to detect which branch we've detached from.
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/buildinfo.cmake21
1 files changed, 18 insertions, 3 deletions
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index af0ccd250e8..1f0a283ba0e 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -27,13 +27,12 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND git branch --list master --contains ${MY_WC_HASH}
+ execute_process(COMMAND git branch --list master blender-v* --contains ${MY_WC_HASH}
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_contains_check
OUTPUT_STRIP_TRAILING_WHITESPACE)
- STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}")
- if(_git_contains_check STREQUAL "master")
+ if(NOT _git_contains_check STREQUAL "")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git show-ref --tags -d
@@ -48,6 +47,22 @@ if(EXISTS ${SOURCE_DIR}/.git)
if(_git_tag_hashes MATCHES "${_git_head_hash}")
set(MY_WC_BRANCH "master")
+ else()
+ execute_process(COMMAND git branch --contains ${MY_WC_HASH}
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE _git_contains_branches
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "^\\*[ \t]+" "" _git_contains_branches "${_git_contains_branches}")
+ string(REGEX REPLACE "[\r\n]+" ";" _git_contains_branches "${_git_contains_branches}")
+ string(REGEX REPLACE ";[ \t]+" ";" _git_contains_branches "${_git_contains_branches}")
+ foreach(_branch ${_git_contains_branches})
+ if (NOT "${_branch}" MATCHES "\\(HEAD.*")
+ set(MY_WC_BRANCH "${_branch}")
+ break()
+ endif()
+ endforeach()
+ unset(_branch)
+ unset(_git_contains_branches)
endif()
unset(_git_tag_hashes)