cmake: refactor GitUtilities.cmake

Remote branch name can now be resolved from detached HEAD.
This commit is contained in:
James R 2022-12-27 00:34:20 -08:00 committed by NepDisk
parent fb34898a29
commit 5b1345cfd1

View file

@ -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)