From 77d663dfd484e55b5a0742d55aaf22d75114d15e Mon Sep 17 00:00:00 2001 From: tidy-dev <75402236+tidy-dev@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:38:52 -0400 Subject: [PATCH] Check if the path being checked is the repo found path --- app/src/ui/add-repository/create-repository.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/ui/add-repository/create-repository.tsx b/app/src/ui/add-repository/create-repository.tsx index 392c473a7af..14d635a7719 100644 --- a/app/src/ui/add-repository/create-repository.tsx +++ b/app/src/ui/add-repository/create-repository.tsx @@ -63,6 +63,14 @@ export const isGitRepository = async (path: string) => { return directoryExists(join(path, '.git')) } + if (type.kind === 'regular') { + // If the path is a regular repository, we'll check if the top level. If it + // isn't than, the path is a subfolder of the repository and a user may want + // to make it into a repository. + // TODO: Opportunity to provide information about submodules? + return type.topLevelWorkingDirectory === path + } + return type.kind !== 'missing' }