Skip to content
Snippets Groups Projects
Commit 64ef0d41 authored by Matthias Schmiddunser's avatar Matthias Schmiddunser
Browse files

Use git describe for version

parent fc61d6fb
No related branches found
No related tags found
No related merge requests found
......@@ -147,7 +147,8 @@ if (iproc.eq.0) then
write (*,'(a)') '! 8888888P" "Y88888P" "Y88888P" d88P 888 888 T88b |'
write (*,'(a)') '! |'
write(*,'(a,i1,a,i1,a,i1,a,i1,a,a8,a)') '! DOUAR-WSMP version ',params%vermajor,'.',params%verminor,'.',params%verstat,'.',params%verrev,' |'
write(*,'(a2,a70)') '! ', 'git commit '//githashshort//' by '//gitauthor//' on '//gitdate//' |'
write(*,'(a2,a62)') '! ', 'git version '//gitversion//' |'
write(*,'(a2,a64)') '! ', 'commited by '//gitauthor//' on '//gitdate//' |'
write(*,'(a,a68,a)') '! ',githash,' |'
if (gituntracked > 0 .AND. gitmodified > 0) then
write (*,'(a37,i1,a15,i1,a18)') '! CAUTION: source directory contains ',gituntracked,' untracked and ',gitmodified,' modified files! |'
......
......@@ -11,17 +11,20 @@
githash=`git log --pretty=format:"%H" -n 1 HEAD`
githashshort=`git log --pretty=format:"%h" -n 1 HEAD`
gitauthor=`git log --pretty=format:"%an" -n 1 HEAD`
gitdate=`git log --pretty=format:"%ad" -n 1 HEAD`
gitdate=`git log --date=iso --pretty=format:"%ad" -n 1 HEAD`
gitdate=${gitdate:0:16}
gitvers=`git describe HEAD`
gituntracked=`git status --porcelain | grep -e '^??' | wc -l`
gitmodified=`git status --porcelain | grep -e '^ M' | wc -l`
# Generate new module_gitversion.f90
echo "module gitversion" > module_gitversion.f90
echo "" >> module_gitversion.f90
echo " character('${#githash}'), parameter :: githash = '$githash'" >> module_gitversion.f90
echo " character('${#githashshort}'), parameter :: githashshort = '$githashshort'" >> module_gitversion.f90
echo " character('${#gitauthor}'), parameter :: gitauthor = '$gitauthor'" >> module_gitversion.f90
echo " character('${#gitdate}'), parameter :: gitdate = '$gitdate'" >> module_gitversion.f90
echo " character(${#githash}), parameter :: githash = '$githash'" >> module_gitversion.f90
echo " character(${#githashshort}), parameter :: githashshort = '$githashshort'" >> module_gitversion.f90
echo " character(${#gitauthor}), parameter :: gitauthor = '$gitauthor'" >> module_gitversion.f90
echo " character(${#gitdate}), parameter :: gitdate = '$gitdate'" >> module_gitversion.f90
echo " character(${#gitvers}), parameter :: gitvers = '$gitvers'" >> module_gitversion.f90
echo " integer, parameter :: gituntracked = $gituntracked" >> module_gitversion.f90
echo " integer, parameter :: gitmodified = $gitmodified" >> module_gitversion.f90
echo "" >> module_gitversion.f90
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment