<br><br><div class="gmail_quote">On Wed, Feb 22, 2012 at 2:57 PM, Herbert Valerio Riedel <span dir="ltr"><<a href="mailto:hvr@gnu.org">hvr@gnu.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Eugene Kirpichov <<a href="mailto:ekirpichov@gmail.com">ekirpichov@gmail.com</a>> writes:<br>
<br>
> It can be used like this:<br>
><br>
> {-# LANGUAGE TemplateHaskell #-}<br>
> import Distribution.VcsRevision.Git<br>
> import Language.Haskell.TH.Syntax<br>
><br>
> showMyGitVersion :: String<br>
> showMyGitVersion = $(do<br>
> v <- qRunIO getRevision<br>
> lift $ case v of<br>
> Nothing -> "<none>"<br>
> Just (hash,True) -> hash ++ " (with local modifications)"<br>
> Just (hash,False) -> hash)<br>
<br>
</div>Btw, I'm wondering (haven't tried myself), when using TH to generate the<br>
version string, does GHC's and/or cabal's dependency tracking<br>
<br>
a) reliably refresh the generated hash so that you can be sure it's<br>
the git-commit id compiled into the binary is reliable, and<br>
<br>
b) avoid re-generating the TH file and redundant recompilation if the<br>
git commit-id hasn't changed?<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>Do you mean all this in the context where this resides in a library rather than an application? I haven't thought about that yet.</div><div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
hvr<br>
--<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Eugene Kirpichov<br>Principal Engineer, Mirantis Inc. <a href="http://www.mirantis.com/" target="_blank">http://www.mirantis.com/</a><br>Editor, <a href="http://fprog.ru/" target="_blank">http://fprog.ru/</a><br>