From 5b1345cfd1388c697d2d513db2bc42ef2547b294 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 27 Dec 2022 00:34:20 -0800 Subject: [PATCH] cmake: refactor GitUtilities.cmake Remote branch name can now be resolved from detached HEAD. --- cmake/Modules/GitUtilities.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/GitUtilities.cmake b/cmake/Modules/GitUtilities.cmake index dbd3a31e9..bddc552a6 100644 --- a/cmake/Modules/GitUtilities.cmake +++ b/cmake/Modules/GitUtilities.cmake @@ -26,7 +26,7 @@ function(git_current_branch variable) # If a detached head, a ref could still be resolved. if("${output}" STREQUAL "") - _git_command(describe --all --exact-match --exclude */HEAD) + _git_command(describe --all --exact-match) # Get the ref, in the form heads/master or # remotes/origin/master so isolate the final part. @@ -50,8 +50,8 @@ function(git_working_tree_dirty variable) endif() endfunction() -function(git_subject variable) - _git_easy_command(log -1 --format=%s) +function(git_summary variable) + _git_easy_command(log -1 "--format=%h %s") endfunction() function(get_git_dir variable)