Change get_git_commit to return full commit hash

This patch changes get_git_commit to always return the full hash.
Since different git versions do not agree on the length of the
abbreviated hash this made the length flaky. To make the length
consistent change it to always be the full hash.
This commit is contained in:
Sven Klemm 2022-08-01 09:52:19 +02:00 committed by Sven Klemm
parent 65b5dc900f
commit 49b6486dad
4 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,7 @@ if(GIT_FOUND)
# Fetch the commit HASH of head (short version) using rev-parse
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE EXT_GIT_COMMIT_HASH
RESULT_VARIABLE _revparse_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)

View File

@ -4,10 +4,11 @@
-- Check what get_git_commit returns
SELECT pg_typeof(commit_tag) AS commit_tag_type,
pg_typeof(commit_hash) AS commit_hash_type,
length(commit_hash) AS commit_hash_length,
pg_typeof(commit_time) AS commit_time_type
FROM _timescaledb_internal.get_git_commit();
commit_tag_type | commit_hash_type | commit_time_type
-----------------+------------------+--------------------------
text | text | timestamp with time zone
commit_tag_type | commit_hash_type | commit_hash_length | commit_time_type
-----------------+------------------+--------------------+--------------------------
text | text | 40 | timestamp with time zone
(1 row)

View File

@ -42,9 +42,7 @@ foreach(TEMPLATE_FILE ${TEST_TEMPLATES_SHARED})
list(APPEND TEST_FILES_SHARED ${TEST_FILE})
endforeach(TEMPLATE_FILE)
if(DEFINED EXT_GIT_COMMIT_TAG
OR DEFINED EXT_GIT_COMMIT_HASH
OR DEFINED EXT_GIT_COMMIT_TIME)
if(DEFINED GIT_FOUND)
list(APPEND TEST_FILES_SHARED build_info.sql)
endif()

View File

@ -5,6 +5,7 @@
-- Check what get_git_commit returns
SELECT pg_typeof(commit_tag) AS commit_tag_type,
pg_typeof(commit_hash) AS commit_hash_type,
length(commit_hash) AS commit_hash_length,
pg_typeof(commit_time) AS commit_time_type
FROM _timescaledb_internal.get_git_commit();