3

我正在使用 tup 构建一个项目,并希望将当前提交的 SHA 包含到二进制文件中。问题是 tup 无法识别 .git 目录中的依赖关系,并且 git HEAD 更改时版本文件不会重建。

有问题的 Tupfile 包含:

: |> git rev-parse HEAD > %o |> version-file

问题看起来像这样:

% 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.

在 .git 中添加任何文件作为依赖项会导致:

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.

当前 Git 提交更改时如何使 tup 重建版本文件?

4

1 回答 1

0

你看过run ./script args功能吗?你可以在你的 Tupfile 中有一条规则run generate_git_rule.sh,在那个 shell 脚本中,你可以先用你想要的 git 版本更新一个文件,然后将它指定为你的实际规则的输入。

于 2019-03-15T16:35:27.820 回答