一、问题(本轮实测)
`draw-ui` 与 `oil-motion` 目录里**各自带一个内嵌 `.git`** ⇒ 上一次提交把它们记成了 **gitlink(子模块指针)**
⇒ 仓库里只存了一个不属于任何远端的 commit id,**别人克隆下来这两份是空的** ✗(`git status` 显示 ` m draw-ui` / ` m oil-motion` = 子模块内容有改动)。
二、处置(可回退)
· 把两处的 `.git` **挪走**(⛔ 不是删除)⇒ `归档/内嵌git-20261008/{draw-ui,oil-motion}.git`;
· `git rm --cached` 掉那两个 gitlink,再 `git add` 两个目录 ⇒ **按正常文件入库**(内容才真的进仓库)。
三、副作用(如实记)
挪走 `.git` 后,这两个技能**不能再原地 `git pull` 取上游更新**(要更新得重新拉一份覆盖);
如需恢复其本地仓库,把 `归档/内嵌git-20261008/` 里的 `.git` 挪回原处即可。
48 lines
1.4 KiB
Bash
48 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
test_tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$test_tmp"' EXIT
|
|
|
|
assert_codex_does_not_create_venv() {
|
|
local name="$1"
|
|
shift
|
|
local venv_path="$test_tmp/$name"
|
|
DRAW_VENV="$venv_path" bash "$repo_dir/scripts/ask_draw.sh" "$@" --help >/dev/null
|
|
[[ ! -e "$venv_path" ]] || {
|
|
printf 'Codex bootstrap unexpectedly created %s\n' "$venv_path" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
assert_codex_does_not_create_venv separated --provider codex
|
|
assert_codex_does_not_create_venv equals --provider=codex
|
|
assert_codex_does_not_create_venv repeated --provider zenmux --provider=codex
|
|
|
|
env_venv="$test_tmp/env-default"
|
|
DRAW_PROVIDER=codex DRAW_VENV="$env_venv" bash "$repo_dir/scripts/ask_draw.sh" --help >/dev/null
|
|
[[ ! -e "$env_venv" ]] || {
|
|
printf 'Codex environment default unexpectedly created %s\n' "$env_venv" >&2
|
|
exit 1
|
|
}
|
|
|
|
for bad_args in "--provider" "--provider=" "--provider unknown"; do
|
|
bad_venv="$test_tmp/bad-${bad_args//[^a-zA-Z0-9]/-}"
|
|
set +e
|
|
# shellcheck disable=SC2086
|
|
DRAW_VENV="$bad_venv" bash "$repo_dir/scripts/ask_draw.sh" $bad_args >/dev/null 2>&1
|
|
status=$?
|
|
set -e
|
|
[[ "$status" -eq 2 ]] || {
|
|
printf 'Expected exit 2 for %s, got %s\n' "$bad_args" "$status" >&2
|
|
exit 1
|
|
}
|
|
[[ ! -e "$bad_venv" ]] || {
|
|
printf 'Invalid provider unexpectedly created %s\n' "$bad_venv" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
printf 'ask_draw.sh bootstrap tests passed\n'
|