0

I have a pre-commit hook in my .hgrc file which checks if more than 5MB of files will be added to the repository. The hook is:

pre-commit.added-files-too-large = test 5000 -gt `hg status --added --no-status --print0 | xargs --null ls -lk | awk \'{sum += $5} END {print sum}\'`

This works fine on Linux (using bash) but doesn't work on MinGW. If I simply run the same command from the MinGW shell command line it works as expected.

The error message is

test: invalid integer ``hg'

I suspect that the error is something to do with how things are quoted but I've tried lots of combinations (including changing the backticks to $()) and I can't seem to find the correct answer.

Any help or pointers would be greatly appreciated.

4

1 回答 1

0

我的猜测是嵌入式脚本会打印某种错误,因此测试会看到字符串而不是数字。

从命令行运行命令hs status...以查看它打印的内容。

于 2011-06-03T11:37:05.657 回答