openPublicStore: tighten bare-repo guard with git rev-parse --is-bare-repository
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- git, typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu trong apps/api/src/store/public.ts tại openPublicStore và xem lại guard .git hiện tại quanh các dòng 80-87. Kiểm tra kết quả đồng bộ của git rev-parse --is-bare-repository đối với các đường dẫn repository bare, non-bare và không hợp lệ; hoàn thành khi các repository non-bare hoặc các lần kiểm tra thất bại throw lỗi remediation có cấu trúc hiện có, trong khi các repository bare hợp lệ tiếp tục được xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
PR #86's openPublicStore (apps/api/src/store/public.ts:80-87) guards against non-bare clones via:
```ts
if (existsSync(join(repoPath, '.git'))) {
throw new Error(`CFP_DATA_REPO_PATH=${repoPath} looks like a non-bare clone ...`);
}
```
This catches the common misconfiguration (someone ran `git clone` instead of `git clone --bare`) but isn't the authoritative check. A directory created with `git init` (non-bare, no `.git` subdir because the path IS the working tree's gitdir... wait, no — `git init` creates `.git/`) — actually, the more interesting failure mode is something like a partially-initialized directory, or a future case where someone manually constructs a layout the existsSync check misses.
The authoritative check is git's own:
```bash
git -C "$repoPath" rev-parse --is-bare-repository
Prints 'true' for a bare repo, 'false' otherwise; exits non-zero if not a repo at all.
```
Proposed change
Replace the existsSync check in `openPublicStore` with a synchronous spawn of `git rev-parse --is-bare-repository` against `repoPath`, asserting the output is `true`. On `false` or non-zero exit, throw the same shaped error with the same remediation message.
Cost: one subprocess at boot (already paying many). Benefit: the guard catches every non-bare shape, not just the one we thought of.
Why backlog
The current guard catches the realistic misconfiguration today. This is hardening, not a fix. Trivially-sized PR (~10 lines), open to picking up anytime.
Filed as follow-up from PR #86.
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 1
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 25
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CodeForPhilly/codeforphilly-ng
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
MarkdownEditor toolbar: use Radix Toolbar from radix-ui instead of the hand-rolled roving tabindex Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Tất cả issue của CodeForPhilly/codeforphilly-ng
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Đang mởbug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Client support matrix inclusion Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
calcite-components needs triage refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Esri/calcite-design-system#15203 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
danielmiessler/LifeOS#2218 ·