From b62ab4b5786d55f7f2d70a71410f83f8ce91af6a Mon Sep 17 00:00:00 2001 From: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com> Date: Sat, 15 Nov 2025 11:23:19 -0800 Subject: [PATCH] cmake,meson: fix inclusion of GPG info in Git commit info (#12302) This manifested for me as a failure to build plugins with `hyprpm`, but the root cause was GPG data getting incorporated into `src/version.h`, like so: ```c #define GIT_COMMIT_MESSAGE "gpg: Signature made Sun 09 Nov 2025 03:31:36 PM PST gpg: using EDDSA key E26A4A2AB9676F54149F8EAA665806380871D640 gpg: Can't check signature: No public key version: bump to 0.52.1" ``` This affected both `GIT_COMMIT_MESSAGE` and `GIT_COMMIT_DATE`, since those are generated via `git show` (which can generate that extra GPG info if the user's personal Git config sets `log.showSignature`). See: https://github.com/hyprwm/Hyprland/discussions/12282 --- CMakeLists.txt | 4 ++-- meson.build | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29de4a324..91443da6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,10 +155,10 @@ if(Git_FOUND) execute_process(COMMAND ${GIT_EXECUTABLE} branch --show-current WORKING_DIRECTORY ${GIT_TOPLEVEL} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%s + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%s --no-show-signature WORKING_DIRECTORY ${GIT_TOPLEVEL} OUTPUT_VARIABLE GIT_COMMIT_MESSAGE OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%cd --date=local + execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%cd --date=local --no-show-signature WORKING_DIRECTORY ${GIT_TOPLEVEL} OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- diff --git a/meson.build b/meson.build index c7819e80b..e1e2df949 100644 --- a/meson.build +++ b/meson.build @@ -46,8 +46,8 @@ git = find_program('git', required: false) if git.found() git_hash = run_command(git, 'rev-parse', 'HEAD').stdout().strip() git_branch = run_command(git, 'branch', '--show-current').stdout().strip() - git_message = run_command(git, 'show', '-s', '--format=%s').stdout().strip() - git_date = run_command(git, 'show', '-s', '--format=%cd', '--date=local').stdout().strip() + git_message = run_command(git, 'show', '-s', '--format=%s', '--no-show-signature').stdout().strip() + git_date = run_command(git, 'show', '-s', '--format=%cd', '--date=local', '--no-show-signature').stdout().strip() git_dirty = run_command(git, 'diff-index', '--quiet', 'HEAD', '--', check: false).returncode() != 0 ? 'dirty' : 'clean' git_tag = run_command(git, 'describe', '--tags').stdout().strip() git_commits = run_command(git, 'rev-list', '--count', 'HEAD').stdout().strip()