Returns the git hash of the current commit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | :: | length_in |
How many characters of the hash to return, default is 7 |
function get_git_hash(length_in)
implicit none
!> How many characters of the hash to return, default is 7
integer, optional, intent(in) :: length_in
integer :: length
character(:), allocatable :: get_git_hash
length = 7
if (present(length_in)) then
if (length_in <= 40) then
length = length_in
end if
end if
allocate(character(length)::get_git_hash)
get_git_hash = GIT_HASH(1:length)
end function get_git_hash