From a5fa1f43f3f11181ebf492599f6724689d9b0058 Mon Sep 17 00:00:00 2001 From: king Date: Sun, 24 May 2026 15:15:42 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20push=5Fto=5Fgitea.bat=20=EC=9D=B8?= =?UTF-8?q?=EC=BD=94=EB=94=A9=20=EB=B0=8F=20=EA=B5=AC=EB=AC=B8=20=ED=98=B8?= =?UTF-8?q?=ED=99=98=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 한글 제거 (Windows cmd 인코딩 문제) - for 멀티라인 구문 → 서브루틴 방식으로 변경 Co-Authored-By: Claude Sonnet 4.6 --- push_to_gitea.bat | 85 ++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 52 deletions(-) diff --git a/push_to_gitea.bat b/push_to_gitea.bat index bb327b5..e98dba4 100644 --- a/push_to_gitea.bat +++ b/push_to_gitea.bat @@ -1,32 +1,23 @@ @echo off -chcp 65001 > nul cd /d "%~dp0" echo. echo ========================================= echo DBX CORM - Gitea Push -echo https://gitea.no1king.freeddns.org/king/dbx-corm echo ========================================= echo. -REM 민감 파일 추적 확인 -echo [1/5] Checking for sensitive files... +echo [1/4] Checking for sensitive files... + set FOUND=0 -for %%F in ( - .env - cafe24_tokens.json - manual-ordering.json -) do ( - git ls-files --error-unmatch "%%F" >nul 2>&1 - if not errorlevel 1 ( - echo [ERROR] Sensitive file is tracked by git: %%F - set FOUND=1 - ) -) +call :check_file .env +call :check_file cafe24_tokens.json +call :check_file manual-ordering.json + if %FOUND%==1 ( echo. echo PUSH BLOCKED. Remove with: - echo git rm --cached ^ + echo git rm --cached FILENAME echo git commit -m "remove sensitive file" echo. pause @@ -35,57 +26,38 @@ if %FOUND%==1 ( echo OK. echo. -REM Git 상태 -echo [2/5] Git status: +echo [2/4] Git status: echo ----------------------------------------- git status -s echo ----------------------------------------- echo. -REM 변경사항 없으면 종료 -git diff --quiet -set DIFF1=%errorlevel% -git diff --cached --quiet -set DIFF2=%errorlevel% -git ls-files --others --exclude-standard | findstr /r "." >nul -set DIFF3=%errorlevel% - -if "%DIFF1%"=="0" if "%DIFF2%"=="0" if not "%DIFF3%"=="0" ( - echo No changes to commit. Exiting. - pause - exit /b 0 -) - -REM 스테이징 -echo [3/5] Staging files... +echo [3/4] Staging all changes... git add -A echo OK. echo. -REM 커밋 메시지 입력 -echo [4/5] Enter commit message: +echo Enter commit message (or press Enter to skip commit and just push): +set "MSG=" set /p MSG=^>^> -if "%MSG%"=="" ( - echo [ERROR] Empty commit message. - pause - exit /b 1 -) - -git commit -m "%MSG%" -if errorlevel 1 ( - echo [ERROR] Commit failed. - pause - exit /b 1 +if not "%MSG%"=="" ( + git diff --cached --quiet + if errorlevel 1 ( + git commit -m "%MSG%" + if errorlevel 1 ( + echo [ERROR] Commit failed. + pause + exit /b 1 + ) + ) else ( + echo No staged changes. Skipping commit. + ) ) echo. -REM Push -echo [5/5] Pushing to Gitea... +echo [4/4] Pushing to Gitea... git push -u origin master -if errorlevel 1 ( - git push -u origin main -) if %errorlevel%==0 ( echo. @@ -99,3 +71,12 @@ if %errorlevel%==0 ( ) echo. pause +exit /b 0 + +:check_file +git ls-files --error-unmatch "%~1" >nul 2>&1 +if not errorlevel 1 ( + echo [ERROR] Sensitive file is tracked by git: %~1 + set FOUND=1 +) +exit /b 0