From f0c49d1fc8cba36afab485b69041a98c92db0dc8 Mon Sep 17 00:00:00 2001 From: Lectom C Han Date: Fri, 19 Dec 2025 17:58:35 +0900 Subject: [PATCH] =?UTF-8?q?gir=20protocal=20v2=20=EA=B0=95=EC=A0=9C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/backup.yml | 8 +++++++- .gitea/workflows/single_branch_backup.yml | 5 ++++- to-do.md | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/backup.yml b/.gitea/workflows/backup.yml index 4f8af05..eb9cab4 100644 --- a/.gitea/workflows/backup.yml +++ b/.gitea/workflows/backup.yml @@ -43,6 +43,8 @@ jobs: NOTIFY_WEBHOOK: ${{ vars.NOTIFY_WEBHOOK }} # Optional chat webhook SYNC_TAGS: ${{ vars.SYNC_TAGS }} # Optional, "false" to skip tag sync TARGET_SEED_DEPTH: ${{ vars.TARGET_SEED_DEPTH }} # Optional, fallback seed depth (default 50) + USE_SHALLOW_EXCLUDE: ${{ vars.USE_SHALLOW_EXCLUDE }} # Optional, "false" to disable shallow-exclude + GIT_PROTOCOL: version=2 run: | set -euo pipefail @@ -53,6 +55,10 @@ jobs: NOTIFY_WEBHOOK="${NOTIFY_WEBHOOK:-}" SYNC_TAGS="${SYNC_TAGS:-true}" TARGET_SEED_DEPTH="${TARGET_SEED_DEPTH:-50}" + USE_SHALLOW_EXCLUDE="${USE_SHALLOW_EXCLUDE:-true}" + if [[ "${USE_SHALLOW_EXCLUDE}" == "false" ]]; then + echo "::notice::Shallow-exclude disabled by configuration." + fi if ! [[ "${TARGET_SEED_DEPTH}" =~ ^[0-9]+$ ]] || (( TARGET_SEED_DEPTH <= 0 )); then echo "::warning::TARGET_SEED_DEPTH(${TARGET_SEED_DEPTH}) is invalid; resetting to 50" TARGET_SEED_DEPTH=50 @@ -395,7 +401,7 @@ jobs: exec_start_epoch=$(date +%s) shallow_exclude_args=() - if ${repo_exists} && [[ -n "${target_commit:-}" ]]; then + if ${repo_exists} && [[ -n "${target_commit:-}" ]] && [[ "${USE_SHALLOW_EXCLUDE}" != "false" ]]; then shallow_exclude_args=(--shallow-exclude="${target_commit}") fi diff --git a/.gitea/workflows/single_branch_backup.yml b/.gitea/workflows/single_branch_backup.yml index cd76a21..173c85a 100644 --- a/.gitea/workflows/single_branch_backup.yml +++ b/.gitea/workflows/single_branch_backup.yml @@ -39,6 +39,8 @@ jobs: INPUT_BRANCHES: ${{ github.event.inputs.branches }} NOTIFY_WEBHOOK: ${{ vars.NOTIFY_WEBHOOK }} # Optional chat webhook SYNC_TAGS: ${{ vars.SYNC_TAGS }} # Optional, "false" to skip tag sync + USE_SHALLOW_EXCLUDE: ${{ vars.USE_SHALLOW_EXCLUDE }} # Optional, "false" to disable shallow-exclude + GIT_PROTOCOL: version=2 run: | set -euo pipefail @@ -49,6 +51,7 @@ jobs: NOTIFY_WEBHOOK="${NOTIFY_WEBHOOK:-}" SYNC_TAGS="${SYNC_TAGS:-true}" TARGET_SEED_DEPTH="${TARGET_SEED_DEPTH:-50}" + USE_SHALLOW_EXCLUDE="${USE_SHALLOW_EXCLUDE:-true}" TOTAL_SUCCESS=0 TOTAL_SKIP=0 TOTAL_ERROR=0 @@ -262,7 +265,7 @@ jobs: fi fi shallow_exclude_args=() - if ${repo_exists} && [[ -n "${target_commit:-}" ]]; then + if ${repo_exists} && [[ -n "${target_commit:-}" ]] && [[ "${USE_SHALLOW_EXCLUDE}" != "false" ]]; then shallow_exclude_args=(--shallow-exclude="${target_commit}") fi diff --git a/to-do.md b/to-do.md index 1b35ff6..2f294be 100644 --- a/to-do.md +++ b/to-do.md @@ -24,6 +24,8 @@ - 2025-12-19: backup.yml에 중복된 Step 1 코드 블록으로 `continue`/`fi` 구문 오류 발생 → 중복 블록 제거하고 단일 ls-remote 결과만 사용. - 2025-12-19: 보고서 생성 스텝이 로그 부재로 실패 → 보고서 생성 스텝을 분리하고 로그가 없을 때도 기본 테이블을 출력하도록 방어 로직 추가. - 2025-12-19: TSV 제거 후 남은 `TARGET_HEADS_FILE` 참조로 unbound variable 오류 발생 → 잔여 echo를 제거해 변수 미정의 오류 해결. +- 2025-12-19: 소스 서버가 shallow-exclude를 지원하지 않는 환경에서 반복 오류 발생 → USE_SHALLOW_EXCLUDE 변수로 기능을 끌 수 있도록 토글 추가하고 기본값은 켜둔 상태 유지. +- 2025-12-19: shallow-exclude 에러(ambiguous deepen-not) 대응을 위해 워크플로우에 GIT_PROTOCOL=version=2를 설정해 프로토콜 v2를 강제, 서버에서는 git 2.43.0 확인. 2025-12-16 09:04:36 KST 업데이트: mirror.yml에서 대상 저장소를 `git clone --mirror` 대신 `--bare`로 받도록 변경하여 `fatal: --mirror can't be combined with refspecs` 오류를 제거. 기존 저장소가 있을 때는 Gitea 원격을 bare 클론 후 `source` 리모트를 원본 SSH에 추가하고 브랜치만 fetch → `origin`의 `main`으로 강제 푸시하도록 정리. 새 저장소일 때는 원본을 bare 클론해 `origin`을 `source`로 rename 후 Gitea를 `origin`으로 추가, 같은 fetch→push 동작 수행. 작업 루트 경로를 `ROOT_DIR`에 저장해 fetch/push 실패 시에도 항상 원위치로 돌아가며 임시 디렉터리를 정리하도록 수정. 2025-12-16 09:42:00 KST 업데이트: mirror.yml에 NOTIFY_WEBHOOK 기반 상태 알림(start/success/error, 소요시간 포함) 추가 및 heredoc 제거로 문법 오류 수정. 브랜치명 매핑을 확장해 Develop_Net8_* 접두사는 제거, Develop_/develop_ 접두사는 제거하여 `develop_boxzainer` → `boxzainer`로 푸시되도록 수정하고, 접두사 없는 `develop` 등은 그대로 사용.