Skip to content

Commit f3ba10e

Browse files
committed
fix: git pull 加 --no-edit,防止非交互式环境下尝试打开编辑器导致卡死
1 parent 8bd4867 commit f3ba10e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.githooks/submodule/post-push

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ set -e
77
# 获取子模块最新一条 commit 信息
88
COMMIT_MSG=$(git log -1 --pretty=%B)
99

10-
# 父仓库根目录:子模块工作目录是 Lab/React/source,往上两级即 Lab
10+
# 父仓库根目录:子模块均位于 Lab/<dir>/<name>,往上两级即 Lab
11+
# 适用于所有两级深度的子模块(React/source、JS/engine-source 等)
1112
PARENT_DIR=$(cd "$(git rev-parse --show-toplevel)/../.." && pwd)
1213

1314
echo "[post-push] 同步父仓库 Lab 子模块指针..."
1415

1516
cd "$PARENT_DIR" || exit 1
1617

1718
# 先拉取远端最新,避免 non-fast-forward 推送失败(merge 保留历史)
18-
git pull --no-rebase
19+
# --no-edit: 非交互式环境下禁止打开编辑器,自动使用默认 merge commit message
20+
git pull --no-rebase --no-edit
1921

2022
# 暂存 Lab 中所有变更(包括子模块指针及其他未提交内容)
2123
git add -A
@@ -41,5 +43,5 @@ while [ $PUSH_RETRY -gt 0 ]; do
4143
exit 1
4244
fi
4345
echo "[post-push] 推送冲突,正在重新拉取后重试(剩余 $PUSH_RETRY 次)..."
44-
git pull --no-rebase
46+
git pull --no-rebase --no-edit
4547
done

0 commit comments

Comments
 (0)