<html>#2330: include date of build and git hash in documentation
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Roland Haas</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>open</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>enhancement</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>major</td></tr>
<tr><td style='text-align:right'>Component:</td><td>Cactus</td></tr>
</table>

<p>Comment (by Roland Haas):</p>
<p>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 <code>\write18</code> 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:</p>
<div class="codehilite language-tex"><pre><span></span><span class="k">\documentclass</span><span class="nb">{</span>article<span class="nb">}</span>

<span class="k">\begin</span><span class="nb">{</span>document<span class="nb">}</span>

<span class="k">\write</span>18<span class="nb">{</span>git log --format=<span class="k">\%</span>ad --date=format:<span class="k">\%</span>Y-<span class="k">\%</span>m-<span class="k">\%</span>d HEAD<span class="k">\~</span>1..HEAD &gt;HEAD.date<span class="nb">}</span>

<span class="k">\IfFileExists</span><span class="nb">{</span>./HEAD.date<span class="nb">}{</span>
  <span class="c">% file found</span>
  commit date <span class="k">\input</span><span class="nb">{</span>HEAD.date<span class="nb">}</span>
<span class="nb">}{</span>
  <span class="c">% file not found</span>
  documentation build <span class="k">\today</span>
<span class="nb">}</span>

<span class="k">\write</span>18<span class="nb">{</span>rm HEAD.date<span class="nb">}</span>

<span class="k">\end</span><span class="nb">{</span>document<span class="nb">}</span>
</pre></div>


<p>which however will not work as expected if you use just <code>pdflatex</code>:</p>
<div class="codehilite language-plaintext"><pre><span></span>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 <span class="nt">&lt;2019-10-01&gt;</span> 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
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2330/include-date-of-build-and-git-hash-in'>https://bitbucket.org/einsteintoolkit/tickets/issues/2330/include-date-of-build-and-git-hash-in</a></p>
</html>