From ede83ce02e30b00929fd9743472db9fb6f804ae9 Mon Sep 17 00:00:00 2001 From: ln Date: Tue, 1 Apr 2025 12:38:41 +0200 Subject: [PATCH] fix: change repo detection to search also in upper paths --- apps/backend/src/infrastructure/git.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/backend/src/infrastructure/git.ts b/apps/backend/src/infrastructure/git.ts index 3b92b0d..e3905ea 100644 --- a/apps/backend/src/infrastructure/git.ts +++ b/apps/backend/src/infrastructure/git.ts @@ -1,10 +1,14 @@ -import { spawn, spawnSync } from 'child_process'; -import * as fs from 'fs'; +import { execSync, spawn, spawnSync } from 'child_process'; import { noLimits } from '../model/limits'; export function isRepo(): boolean { - return fs.existsSync('.git'); + try { + execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' }); + return true; + } catch (error) { + return false; + } } export function calcTreeHash(): string {