chore: push_to_gitea.bat 인코딩 및 구문 호환성 수정
- 한글 제거 (Windows cmd 인코딩 문제) - for 멀티라인 구문 → 서브루틴 방식으로 변경 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+33
-52
@@ -1,32 +1,23 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 > nul
|
|
||||||
cd /d "%~dp0"
|
cd /d "%~dp0"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo =========================================
|
echo =========================================
|
||||||
echo DBX CORM - Gitea Push
|
echo DBX CORM - Gitea Push
|
||||||
echo https://gitea.no1king.freeddns.org/king/dbx-corm
|
|
||||||
echo =========================================
|
echo =========================================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM 민감 파일 추적 확인
|
echo [1/4] Checking for sensitive files...
|
||||||
echo [1/5] Checking for sensitive files...
|
|
||||||
set FOUND=0
|
set FOUND=0
|
||||||
for %%F in (
|
call :check_file .env
|
||||||
.env
|
call :check_file cafe24_tokens.json
|
||||||
cafe24_tokens.json
|
call :check_file manual-ordering.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
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if %FOUND%==1 (
|
if %FOUND%==1 (
|
||||||
echo.
|
echo.
|
||||||
echo PUSH BLOCKED. Remove with:
|
echo PUSH BLOCKED. Remove with:
|
||||||
echo git rm --cached ^<filename^>
|
echo git rm --cached FILENAME
|
||||||
echo git commit -m "remove sensitive file"
|
echo git commit -m "remove sensitive file"
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
@@ -35,57 +26,38 @@ if %FOUND%==1 (
|
|||||||
echo OK.
|
echo OK.
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM Git 상태
|
echo [2/4] Git status:
|
||||||
echo [2/5] Git status:
|
|
||||||
echo -----------------------------------------
|
echo -----------------------------------------
|
||||||
git status -s
|
git status -s
|
||||||
echo -----------------------------------------
|
echo -----------------------------------------
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM 변경사항 없으면 종료
|
echo [3/4] Staging all changes...
|
||||||
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...
|
|
||||||
git add -A
|
git add -A
|
||||||
echo OK.
|
echo OK.
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM 커밋 메시지 입력
|
echo Enter commit message (or press Enter to skip commit and just push):
|
||||||
echo [4/5] Enter commit message:
|
set "MSG="
|
||||||
set /p MSG=^>^>
|
set /p MSG=^>^>
|
||||||
|
|
||||||
if "%MSG%"=="" (
|
if not "%MSG%"=="" (
|
||||||
echo [ERROR] Empty commit message.
|
git diff --cached --quiet
|
||||||
pause
|
if errorlevel 1 (
|
||||||
exit /b 1
|
git commit -m "%MSG%"
|
||||||
)
|
if errorlevel 1 (
|
||||||
|
echo [ERROR] Commit failed.
|
||||||
git commit -m "%MSG%"
|
pause
|
||||||
if errorlevel 1 (
|
exit /b 1
|
||||||
echo [ERROR] Commit failed.
|
)
|
||||||
pause
|
) else (
|
||||||
exit /b 1
|
echo No staged changes. Skipping commit.
|
||||||
|
)
|
||||||
)
|
)
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM Push
|
echo [4/4] Pushing to Gitea...
|
||||||
echo [5/5] Pushing to Gitea...
|
|
||||||
git push -u origin master
|
git push -u origin master
|
||||||
if errorlevel 1 (
|
|
||||||
git push -u origin main
|
|
||||||
)
|
|
||||||
|
|
||||||
if %errorlevel%==0 (
|
if %errorlevel%==0 (
|
||||||
echo.
|
echo.
|
||||||
@@ -99,3 +71,12 @@ if %errorlevel%==0 (
|
|||||||
)
|
)
|
||||||
echo.
|
echo.
|
||||||
pause
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user