我在远程裸 Git 存储库上有一个预接收挂钩,当我从笔记本电脑执行测试时,它将运行测试、压缩一些文件并生成构建 ID:
$ git push production master
pre-receive hook 的简化版本是这样的:
while read oldrev newrev refname
do
# Export deployed branch to build directory
mkdir -p $BUILD_DIR
git archive $newrev | tar -x -C $BUILD_DIR
cd $BUILD_DIR
the_build_script.sh
done
现在,我在 repo 中添加了两个子模块,但我找不到任何有关如何处理此问题的文档或示例。我知道我应该在构建脚本之前运行:
# git submodule init
# git submodule update
但是,据我所知,这将获得旧修订代码引用的子模块,而不是新推送代码中引用的子模块仍未提交到远程仓库。
关于如何处理这个问题的任何想法或例子?
非常感谢。