Files
clean-architecture-backend-…/.gitignore
DongHyeonka 8def6e0553
pr / done (pull_request) Successful in 1m49s
fix(gitignore): 하위 폴더의 실제 .env 파일도 git이 무시한다
문제: .gitignore의 `/.env*`는 저장소 루트의 .env만 무시한다. 재배치
커밋 1388c06a가 `src/.env*`와 예시 예외 둘을 지우고 루트 줄로
바꿨다. 그래서 src/.env, src/.env.local, 아무 하위 폴더의 .env.lane이
무시되지 않고, `git add -A` 한 번이면 실제 환경 파일이 이력에 들어간다.
scripts/verify.sh는 미추적 파일로 rc=5를 내지만 사람의 커밋은 막지
못한다. 파생 서비스도 같은 .gitignore를 물려받는다.

고른 방법: `**/.env*`로 어느 폴더든 .env로 시작하는 파일을 무시하고,
추적 중인 예시 둘만 `!**/.env.example`, `!**/.env.local.example`로
되살린다. 따로 있던 `/.env.lane` 줄은 이 줄에 들어가서 지웠다.

버린 대안:
- 이름 나열(`**/.env`, `**/.env.local`, `**/.env.lane`): C2 경로는
  모두 막지만 .env.prod·.env.staging 같은 프로필 파일을 놓친다.
  루트에서는 지금 `/.env*`가 막던 .env.<프로필>이 다시 열린다.
- `src/.env*`만 되살리기: 재배치 뒤 다른 하위 폴더(compose-lanes 등)에
  생기는 파일을 또 놓친다.
- `!**/.env*.example`로 예시를 넓게 되살리기: 지금 추적하는 예시는 둘뿐이다.
  넓히면 .env.<무엇>.example 이름의 실제 파일도 열린다. 새 예시는 `!`
  줄을 하나 더하면 된다.

위험·한계: 새 예시 파일(예: .env.lane.example)을 더하면 `!` 줄 없이는
git이 무시한다. 막히는 쪽으로 실패하고, `git add`가 무시된 파일이라고
알린다. 이미 추적 중인 파일은 .gitignore가 빼지 않는다. 이 repo의
추적 목록에는 해당 파일이 없다(`git ls-files -ci --exclude-standard`
빈 결과). 스테이지된 .env 꼴 파일을 막는 pre-commit이나 CI 검사는 없고,
이 커밋도 만들지 않는다.

검증: 실제 .env는 열지 않고, 없는 경로에
`git check-ignore -q --no-index <경로>`를 돌려 rc를 봤다.
- C1: 고치기 전(b2bfb9bb·484264cb, .gitignore blob ae53be55)
  src/.env rc=1. 고친 뒤 rc=0(`**/.env*`).
- C2: .env, .env.local, .env.lane, src/.env, src/.env.local,
  src/.env.lane, sub-x/.env, sub-x/.env.local, sub-x/.env.lane,
  build-x/.env.lane, src/bootstrap/app/compose-lanes/.env,
  deep/a/b/.env.staging, sub-x/.env.prod 모두 rc=0.
  .env.example, .env.local.example, 같은 이름의 src/·sub-x/ 예시는
  모두 rc=1.
- C3: `git ls-files '*.env*'` 전후 모두 .env.example,
  .env.local.example. `git ls-files -ci --exclude-standard` 전후 빈 결과.

Refs: REV-BE-0048
Fixes: 1388c06a9f ("refactor(layout)!: Gradle 루트와 계층 폴더를 옮긴다(옮기기만)")
2026-11-22 02:20:14 +09:00

50 lines
2.0 KiB
Plaintext

.vscode/
src/**/bin/
# Gradle and IDE output. The wrapper jar is the one binary the build needs from the tree.
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
.idea/
*.iml
.project
.classpath
.settings/
# jqwik property-test runtime state
.jqwik-database
# ApprovalTests writes <test>.received.<ext> next to each <test>.approved.<ext> snapshot, under the
# test's source folder, when it compares and deletes it when they match; a failed comparison leaves
# it behind. Approve by copying it over the approved file, never by committing it. Only Java source
# folders: fixtures elsewhere may carry ".received." in their names. An approved snapshot is never
# ignored, even when a test parameter puts ".received." into its name; in turn a received file whose
# parameter puts ".approved." into its name shows up in `git status`.
src/**/src/*/java/**/*.received.*
!src/**/src/*/java/**/*.approved.*
.DS_Store
# Local Claude Code state (worktrees, settings.local.json, notes) stays out. The shared project
# settings, path rules, skills and subagent definitions are committed: everyone who opens the repository gets them (CLAUDE.md).
.claude/*
!.claude/settings.json
!.claude/rules/
!.claude/agents/
!.claude/skills/
# Operator input, not a build input: a real environment file stays out in any folder, not only at
# the root. That covers .env, .env.local, a src/.env left over from before the relayout, the
# .env.lane the runtime-smoke wrapper writes per run, and any .env.<profile>. Only the two examples
# are tracked; they are the contract, and verifyEnvKeys reads the registry, the profile YAMLs and
# .env.example, never a real one. A new example needs its own ! line, or Git ignores it.
**/.env*
!**/.env.example
!**/.env.local.example
# bootRun's file log when APP_LOG_FILE_ENABLED=true: APP_LOG_FILE_PATH is relative to the repository root.
/logs/
# Local tool output (graphify knowledge graph, Playwright MCP snapshots).
graphify-out/
.playwright-mcp/
# Python bytecode from running scripts/ checks; never committed.
__pycache__/
*.pyc