From 231053ea8ae24b9bd91d5bad923bb394213acb7d Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 16 Nov 2020 00:21:30 +0100 Subject: [PATCH] Add some more debugging info Not sure why I get errors where the folder is not a git repo even though it contains a .git folder. --- lib/repository.dart | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/repository.dart b/lib/repository.dart index 666faa84..25ab712a 100644 --- a/lib/repository.dart +++ b/lib/repository.dart @@ -76,7 +76,8 @@ class Repository with ChangeNotifier { var repoPath = settings.buildRepoPath(gitBaseDir); - var repoDirStat = File(repoPath).statSync(); + var repoDir = Directory(repoPath); + var repoDirStat = repoDir.statSync(); /* if (Platform.isIOS && repoDirStat.type == FileSystemEntityType.notFound && @@ -98,6 +99,27 @@ class Repository with ChangeNotifier { settings.save(); } else { + // + // Debugging Info for https://github.com/GitJournal/GitJournal/issues/347 + // + var foundDotGit = false; + await for (var file in repoDir.list()) { + if (p.basename(file.path) == '.git') { + foundDotGit = true; + Log.i(".git directory contents"); + await for (var file in Directory(file.path).list()) { + Log.i("${file.path}"); + } + break; + } + } + if (foundDotGit == false) { + Log.e("Directory exists but .git folder is missing?"); + await for (var file in repoDir.list()) { + Log.i("What is this: ${file.path}"); + } + } + var gitRepo = await GitRepository.load(repoPath); remotes = gitRepo.config.remotes; remoteConfigured = remotes.isNotEmpty;