From 6706f79d4cf7dffedb24e4ad86f9f1538ff96596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Casta=C3=B1eda?= Date: Tue, 13 Feb 2024 17:03:37 +0100 Subject: [PATCH] GitRepository: update on external init --- src/git/GitRepository.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/git/GitRepository.cpp b/src/git/GitRepository.cpp index 07b29fad..79b7f4bd 100644 --- a/src/git/GitRepository.cpp +++ b/src/git/GitRepository.cpp @@ -50,9 +50,10 @@ namespace Genio::Git { bool GitRepository::IsInitialized() { - // if the repository gets corrupted or the .git folder is deleted, we need to check the - // status again and put the repository in an uninitialized state - if (!GitRepository::IsValid(fRepositoryPath)) { + // If the repository gets corrupted or the .git folder is deleted, we need to check the + // status again and put the repository in an uninitialized state. + // If it was not initialized but it is valid now, it may have been initialized externally. + if (!GitRepository::IsValid(fRepositoryPath) || !fInitialized) { fInitialized = false; // Let's make an attempt to reopen the repository if necessary _Open();