fix #17904: hide long gpg signature text from git_commit_hash.h (#17905)
Some checks are pending
Build all / Linux x86_64 (push) Blocked by required conditions
Build all / macOS arm64 (push) Blocked by required conditions
Build all / Look for build script changes (push) Waiting to run
Build all / Windows build script tests (push) Blocked by required conditions
Build all / build_linux (push) Waiting to run
Build all / Build Windows (push) Blocked by required conditions
Build all / build_macos_arch (push) Waiting to run
Build all / Build macOS Universal (push) Blocked by required conditions
Build all / Linux aarch64 (push) Blocked by required conditions
Build all / Windows x64 (push) Blocked by required conditions
Build all / Windows arm64 (push) Blocked by required conditions
Build all / Slice check (Linux aarch64) (push) Blocked by required conditions
Build all / Publish Test Results (push) Blocked by required conditions
Build all / Flatpak (push) Waiting to run

GitCommitHash.cmake: obtain hash via git rev-parse instead of git log for git_commit_hash.h (OrcaSlicer#17904)

when git config log.showSignature=true, the default format for git log
contains the gpg signature. this breaks the git_commit_hash.h file
generated by GitCommitHash.cmake.

fix: obtain hash via rev-parse instead which does not have formatting and
intended for picking out paramteters such as this case.
This commit is contained in:
erentar 2026-11-26 17:51:58 +01:00 • committed by GitHub
parent d528c0ea9a
commit 5c30e3ee97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,7 +22,7 @@ if (DEFINED ENV{git_commit_hash} AND NOT "$ENV{git_commit_hash}" STREQUAL "")
string(SUBSTRING "$ENV{git_commit_hash}" 0 7 HASH)
endif ()
elseif (GIT_FOUND AND EXISTS "${SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${SOURCE_DIR} OUTPUT_VARIABLE HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet HEAD
WORKING_DIRECTORY ${SOURCE_DIR} RESULT_VARIABLE DIRTY ERROR_QUIET)