From be7a7bd35bf1d8697d6a56da6a51d3e3576fbed1 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 1 Mar 2026 09:35:02 -0800 Subject: [PATCH] Remove bare git repo on app deletion --- src/server/api/sync.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/api/sync.ts b/src/server/api/sync.ts index 09c0b45..2563ee6 100644 --- a/src/server/api/sync.ts +++ b/src/server/api/sync.ts @@ -2,10 +2,11 @@ import { APPS_DIR, allApps, emit, registerApp, removeApp, restartApp, startApp } import { computeHash, generateManifest } from '../sync' import { loadGitignore } from '@gitignore' import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs' -import { dirname, join } from 'path' +import { dirname, join, resolve } from 'path' import { Hype } from '@because/hype' const MAX_VERSIONS = 5 +const REPOS_DIR = resolve(process.env.DATA_DIR ?? '.', 'repos') interface FileChangeEvent { hash?: string @@ -210,6 +211,11 @@ router.delete('/apps/:app', c => { removeApp(appName) rmSync(appPath, { recursive: true }) + + // Remove bare git repo if one exists + const repoPath = join(REPOS_DIR, `${appName}.git`) + if (existsSync(repoPath)) rmSync(repoPath, { recursive: true }) + return c.json({ ok: true }) })