openPublicStore: tighten bare-repo guard with git rev-parse --is-bare-repository
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- git, typescript
- Ambito
- backend
Direzione di ricerca
Inizia in apps/api/src/store/public.ts, all’interno di openPublicStore, e rivedi il controllo corrente di .git intorno alle righe 80-87. Verifica il risultato sincrono di git rev-parse --is-bare-repository per percorsi di repository bare, non-bare e non validi; il lavoro è completato quando i repository non-bare o i controlli falliti generano l’errore di remediation con la struttura esistente, mentre i repository bare validi procedono.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 1
- Merge medio
- 1g 20h
- PR unite (30g)
- 25
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeForPhilly/codeforphilly-ng
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
MarkdownEditor toolbar: use Radix Toolbar from radix-ui instead of the hand-rolled roving tabindex Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
Tutte le issue di CodeForPhilly/codeforphilly-ng
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
danielmiessler/LifeOS#2218 ·