Check if repository is corrupted: do not check for etc/ or

opt/-directories, as they may be not existent inside of the repository.
This commit is contained in:
Gerhard Hoffmann 2023-11-03 13:44:15 +01:00
parent 721c5dd7a5
commit 003bd0bf77

View File

@ -215,17 +215,17 @@ void Worker::update() {
bool Worker::isRepositoryCorrupted() { bool Worker::isRepositoryCorrupted() {
QDir customerRepository(m_customerRepository); QDir customerRepository(m_customerRepository);
if (customerRepository.exists()) { if (customerRepository.exists()) {
QDir customerRepositoryEtc(QDir::cleanPath(m_customerRepository + QDir::separator() + "etc/"));
QDir customerRepositoryOpt(QDir::cleanPath(m_customerRepository + QDir::separator() + "opt/"));
QDir customerRepositoryGit(QDir::cleanPath(m_customerRepository + QDir::separator() + ".git/")); QDir customerRepositoryGit(QDir::cleanPath(m_customerRepository + QDir::separator() + ".git/"));
if (!m_gc.gitFsck() if (!m_gc.gitFsck()) {
// etc-directory inside git-repository does not exist, which means the
// git-repository is corrupted -> remove it and start from scratch
|| !customerRepositoryEtc.exists()
|| !customerRepositoryGit.exists()
|| !customerRepositoryOpt.exists()) {
// should never happen // should never happen
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY"); Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY: GIT_FSCK FAILED");
return true;
}
// .git-directory inside git-repository does not exist, which means the
// git-repository is corrupted -> remove it and start from scratch
if (!customerRepositoryGit.exists()) {
// should never happen
Utils::printCriticalErrorMsg("CORRUPTED CUSTOMER REPOSITORY .GIT DOES NOT EXIST");
return true; return true;
} }
} }