♻️ 改用 shared mirror clone 准备 job 工作副本
Ubuntu System Information / show-system-info (push) Successful in 0s
Details
Ubuntu System Information / show-system-info (push) Successful in 0s
Details
This commit is contained in:
parent
173526be79
commit
beab4e5696
|
|
@ -128,7 +128,7 @@ create_job_workspace_from_mirror() {
|
||||||
|
|
||||||
rm -rf "${job_workspace}"
|
rm -rf "${job_workspace}"
|
||||||
mkdir -p "${job_workspace}"
|
mkdir -p "${job_workspace}"
|
||||||
git clone --local "${mirror_path}" "${repo_dir}" >/dev/null
|
git clone --shared "${mirror_path}" "${repo_dir}" >/dev/null
|
||||||
git -C "${repo_dir}" remote set-url origin "${remote_url}"
|
git -C "${repo_dir}" remote set-url origin "${remote_url}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ test_repo_owner_and_name_parsing() {
|
||||||
|
|
||||||
test_prepare_and_cleanup_workspace() {
|
test_prepare_and_cleanup_workspace() {
|
||||||
local temp_root remote_repo seed_repo mirror_root workspace_root env_file
|
local temp_root remote_repo seed_repo mirror_root workspace_root env_file
|
||||||
local repo_dir mirror_path job_workspace origin_url
|
local repo_dir mirror_path job_workspace origin_url alternates_file alternates_target
|
||||||
|
|
||||||
temp_root=$(mktemp -d)
|
temp_root=$(mktemp -d)
|
||||||
remote_repo="${temp_root}/remote.git"
|
remote_repo="${temp_root}/remote.git"
|
||||||
|
|
@ -117,6 +117,15 @@ test_prepare_and_cleanup_workspace() {
|
||||||
origin_url=$(git -C "${repo_dir}" remote get-url origin)
|
origin_url=$(git -C "${repo_dir}" remote get-url origin)
|
||||||
assert_eq "${remote_repo}" "${origin_url}" "prepared repo should point origin to the requested remote"
|
assert_eq "${remote_repo}" "${origin_url}" "prepared repo should point origin to the requested remote"
|
||||||
|
|
||||||
|
alternates_file="${repo_dir}/.git/objects/info/alternates"
|
||||||
|
if [ ! -f "${alternates_file}" ]; then
|
||||||
|
echo "FAIL: prepared repo should use shared mirror objects via alternates" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
alternates_target=$(cat "${alternates_file}")
|
||||||
|
assert_eq "${mirror_path}/objects" "${alternates_target}" "prepared repo should borrow objects from the bare mirror"
|
||||||
|
|
||||||
cleanup_job_workspace "${job_workspace}"
|
cleanup_job_workspace "${job_workspace}"
|
||||||
|
|
||||||
if [ -e "${job_workspace}" ]; then
|
if [ -e "${job_workspace}" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue