[Bf-blender-cvs] [593ed1347c9] master: Build info: Ensure hash length is same across all platforms and has no conflicts

Sergey Sharybin noreply at git.blender.org
Wed Dec 19 12:57:32 CET 2018


Commit: 593ed1347c96aea691eb503a6bbed12c801f3faa
Author: Sergey Sharybin
Date:   Wed Dec 19 12:47:25 2018 +0100
Branches: master
https://developer.blender.org/rB593ed1347c96aea691eb503a6bbed12c801f3faa

Build info: Ensure hash length is same across all platforms and has no conflicts

The original issue was that different platforms will use different
hash lengths, just because defaults on Git client were different.

Now we use explicit length for the hash, and length is the same as
is used for short hashes in Linux -- apparently they started to have
collisions with length of 11.

===================================================================

M	build_files/cmake/buildinfo.cmake
M	build_files/cmake/packaging.cmake

===================================================================

diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index a43b99f5d1e..12bbf49b747 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -22,7 +22,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
 	if(MY_WC_BRANCH STREQUAL "HEAD")
 		# Detached HEAD, check whether commit hash is reachable
 		# in the master branch
-		execute_process(COMMAND git rev-parse --short HEAD
+		execute_process(COMMAND git rev-parse --short=12 HEAD
 		                WORKING_DIRECTORY ${SOURCE_DIR}
 		                OUTPUT_VARIABLE MY_WC_HASH
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -80,12 +80,12 @@ if(EXISTS ${SOURCE_DIR}/.git)
 		if(NOT _git_below_check STREQUAL "")
 			# If there're commits between HEAD and upstream this means
 			# that we're reset-ed to older revision. Use it's hash then.
-			execute_process(COMMAND git rev-parse --short HEAD
+			execute_process(COMMAND git rev-parse --short=12 HEAD
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE MY_WC_HASH
 			                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		else()
-			execute_process(COMMAND git rev-parse --short @{u}
+			execute_process(COMMAND git rev-parse --short=12 @{u}
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE MY_WC_HASH
 			                OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -94,7 +94,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
 			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
+				execute_process(COMMAND git rev-parse --short=12 HEAD
 				                WORKING_DIRECTORY ${SOURCE_DIR}
 				                OUTPUT_VARIABLE MY_WC_HASH
 				                OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake
index 2408e4eaff9..fb69a7c726a 100644
--- a/build_files/cmake/packaging.cmake
+++ b/build_files/cmake/packaging.cmake
@@ -26,7 +26,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
 	find_package(Git)
 	if(GIT_FOUND)
 		# message(STATUS "Found Git: ${GIT_EXECUTABLE}")
-		execute_process(COMMAND git rev-parse --short HEAD
+		execute_process(COMMAND git rev-parse --short=12 HEAD
 		                WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 		                OUTPUT_VARIABLE MY_WC_HASH
 		                OUTPUT_STRIP_TRAILING_WHITESPACE



More information about the Bf-blender-cvs mailing list