Fix bare worktree submodule clone and host AI startup wait on deploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+32
-3
@@ -52,10 +52,39 @@ if [[ ${#SUBMODULE_PATHS[@]} -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
if $INIT && ! $DRY_RUN; then
|
||||
log "submodule init..."
|
||||
git submodule update --init --recursive
|
||||
log "submodule init (direct clone)..."
|
||||
fi
|
||||
|
||||
resolve_monorepo_git_dir() {
|
||||
if [[ -n "${GIT_DIR:-}" && -d "${GIT_DIR}" ]]; then
|
||||
echo "${GIT_DIR}"
|
||||
elif git -C "${ROOT_DIR}" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
git -C "${ROOT_DIR}" rev-parse --git-dir
|
||||
fi
|
||||
}
|
||||
|
||||
submodule_pinned_sha() {
|
||||
local path="$1"
|
||||
local git_dir
|
||||
git_dir="$(resolve_monorepo_git_dir || true)"
|
||||
[[ -n "${git_dir}" ]] || return 0
|
||||
git --git-dir="${git_dir}" ls-tree HEAD "${path}" 2>/dev/null | awk '{print $3}'
|
||||
}
|
||||
|
||||
clone_submodule_repo() {
|
||||
local path="$1" url="$2" branch="$3"
|
||||
local target="${ROOT_DIR}/${path}"
|
||||
local sha
|
||||
|
||||
sha="$(submodule_pinned_sha "${path}" || true)"
|
||||
log " clone ${url} → ${path} (branch=${branch})"
|
||||
rm -rf "${target}"
|
||||
git clone --branch "${branch}" --single-branch "${url}" "${target}"
|
||||
if [[ -n "${sha}" ]]; then
|
||||
git -C "${target}" checkout "${sha}" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
restore_monorepo_overlays() {
|
||||
if [[ -f "${ROOT_DIR}/local-dev/docker-compose.rag.local.yml" ]]; then
|
||||
cp "${ROOT_DIR}/local-dev/docker-compose.rag.local.yml" \
|
||||
@@ -86,7 +115,7 @@ fetch_one() {
|
||||
return 0
|
||||
fi
|
||||
if $INIT; then
|
||||
git submodule update --init "${path}"
|
||||
clone_submodule_repo "${path}" "${url}" "${branch}"
|
||||
else
|
||||
warn "${path} — submodule 미초기화. --init 옵션 사용"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user