증분백업 로직 개선, shallow_exclude 옵션 활용.

This commit is contained in:
Lectom C Han
2025-12-16 18:33:48 +09:00
parent 23be76333e
commit aa5cc8bb9f
3 changed files with 13 additions and 8 deletions

View File

@@ -13,7 +13,7 @@ on:
jobs:
mirror:
runs-on: [internal]
timeout-minutes: 360 # 6 hours timeout
timeout-minutes: 500
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -216,6 +216,10 @@ jobs:
return
fi
fi
shallow_exclude_args=()
if ${repo_exists} && [[ -n "${target_commit:-}" ]]; then
shallow_exclude_args=(--shallow-exclude="${target_commit}")
fi
# Create a temporary directory for cloning
CLONE_DIR=$(mktemp -d)
@@ -242,14 +246,10 @@ jobs:
fi
git remote add origin "${GITEA_REMOTE}"
git remote add source "${source_repo_url}"
echo "Seeding objects from target main for delta fetch..."
if ! git fetch --no-tags origin "+refs/heads/main:refs/heads/main"; then
echo "::warning::Failed to fetch target main; continuing without seed"
fi
fi
echo "Fetching latest branch '${branch_name}' from source..."
if ! git fetch --no-tags source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then
if ! git fetch --no-tags "${shallow_exclude_args[@]}" source "+refs/heads/${branch_name}:refs/heads/${branch_name}"; then
echo "::error::Failed to fetch branch '${branch_name}' from source repo"
notify_status "error" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "source fetch 오류"
cd "${ROOT_DIR}"