From 35341600c1fabb0668a68d3764a0be79f5fc4bda Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 1 Mar 2026 09:34:58 -0800 Subject: [PATCH] Add app-specific git repo view with push instructions --- apps/git/20260228-000000/index.tsx | 81 +++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/apps/git/20260228-000000/index.tsx b/apps/git/20260228-000000/index.tsx index 8e0b688..c011803 100644 --- a/apps/git/20260228-000000/index.tsx +++ b/apps/git/20260228-000000/index.tsx @@ -503,11 +503,88 @@ app.on('POST', ['/:repo{.+\\.git}/git-receive-pack', '/:repo/git-receive-pack'], }) app.get('/', async c => { - const repos = await listRepos() + const appName = c.req.query('app') const host = c.req.header('host') ?? 'git.toes.local' - const baseUrl = `http://${host}` + // When viewing a specific app, only show that app's repo + if (appName) { + const bare = repoPath(appName) + const exists = await dirExists(bare) + const [commits, branch] = exists + ? await Promise.all([hasCommits(bare), getDefaultBranch(bare)]) + : [false, 'main'] + + return c.html( + + {exists && commits ? ( + <> + Repository + + +
+ {appName} + + git clone {baseUrl}/{appName}.git + +
+
+ {branch} + deployed +
+
+
+ + Push Changes + {[ + `git push toes ${branch}`, + '', + '# Or if remote not yet added:', + `git remote add toes ${baseUrl}/${appName}.git`, + `git push toes ${branch}`, + ].join('\n')} + + ) : exists ? ( + <> + Repository + + +
+ {appName} + + git clone {baseUrl}/{appName}.git + +
+ empty +
+
+ + Push to Deploy + {[ + `git remote add toes ${baseUrl}/${appName}.git`, + 'git push toes main', + ].join('\n')} + + ) : ( + <> + Push to Deploy + + No git repository for {appName} yet. + Push to create one and deploy. + + {[ + `git remote add toes ${baseUrl}/${appName}.git`, + 'git push toes main', + ].join('\n')} + + )} +
, + ) + } + + // No app selected — show all repos + const repos = await listRepos() + const repoData = await Promise.all(repos.map(async name => { const bare = repoPath(name) const [commits, branch] = await Promise.all([hasCommits(bare), getDefaultBranch(bare)])