I'm building a project with tup and would like to include the current commit's SHA into the binary. The problem is that tup doesn't recognize dependencies in the .git directory and the version file is not rebuild when the git HEAD changes.
The problematic Tupfile contains:
: |> git rev-parse HEAD > %o |> version-file
The problem looks like this:
% tup
[...]
[ tup ] [0.068s] Executing Commands...
1) [0.026s] git rev-parse HEAD > version-file
[ ] 100%
% git commit --allow-empty -m "Some commit"
[master b9a0874] Some commit
% tup
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.001s] Reading in new environment variables...
[ tup ] [0.001s] No Tupfiles to parse.
[ tup ] [0.001s] No files to delete.
[ tup ] [0.001s] No commands to execute.
[ tup ] [0.001s] Updated.
Adding any files in .git as a dependencies results in:
tup error: You specified a path '.git/refs/heads/*' that contains a hidden filename (since it begins with a '.' character). Tup ignores these files - please remove references to it from the Tupfile.
How do I make tup rebuild version-file when the current Git commit changes?