#2330: include date of build and git hash in documentation
| Reporter: | Roland Haas |
| Status: | open |
| Milestone: | |
| Version: | |
| Type: | enhancement |
| Priority: | major |
| Component: | Cactus |
Comment (by Roland Haas):
The date of the commit would be nicer, unfortunately I do not know of a way to access it without running git. Running git from within LaTeX requires the use of the \write18 primitive which by default (for obvious security reasons) is disabled. So it is not impossible, but tricky. Eg this file roughly demonstrates what would need to be done:
\documentclass{article} \begin{document} \write18{git log --format=\%ad --date=format:\%Y-\%m-\%d HEAD\~1..HEAD >HEAD.date} \IfFileExists{./HEAD.date}{ % file found commit date \input{HEAD.date} }{ % file not found documentation build \today } \write18{rm HEAD.date} \end{document}
which however will not work as expected if you use just pdflatex:
pdflatex git.tex This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./git.tex LaTeX2e <2019-10-01> patch level 3 (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2019/10/25 v1.4k Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./git.au--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2330/include-date-of-build-and-git-hash-in