diff --git a/rs/src/watch_directory.rs b/rs/src/watch_directory.rs index 34b8452..81850a4 100644 --- a/rs/src/watch_directory.rs +++ b/rs/src/watch_directory.rs @@ -36,7 +36,7 @@ pub fn watch_directory( } Err(e) => { if e != RecvTimeoutError::Timeout { - println!("Watch error: {:?}", e) + println!("Watch error: {:?}", e); } } } diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/git/FileChangesWatcher.kt b/src/main/kotlin/com/jetpackduba/gitnuro/git/FileChangesWatcher.kt index 1793dbd..e359d8b 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/git/FileChangesWatcher.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/git/FileChangesWatcher.kt @@ -48,18 +48,21 @@ class FileChangesWatcher @Inject constructor( } val areAllPathsIgnored = paths.all { path -> - val matchesAnyRule = ignoreRules.any { rule -> + val matchesAnyIgnoreRule = ignoreRules.any { rule -> rule.isMatch(path, Files.isDirectory(Paths.get(path))) } val isGitIgnoredFile = gitDirIgnoredFiles.any { ignoredFile -> - "$pathStr/.git/$ignoredFile" == path + "$pathStr$systemSeparator.git$systemSeparator$ignoredFile" == path } - matchesAnyRule || isGitIgnoredFile + // JGit may create .probe-UUID files for its internal stuff, we should not care about it + val onlyProbeFiles = paths.all { it.contains("$systemSeparator.git$systemSeparator.probe-") } + + matchesAnyIgnoreRule || isGitIgnoredFile || onlyProbeFiles } - val hasGitDirChanged = paths.any { it.startsWith("$pathStr$systemSeparator.git%$systemSeparator") } + val hasGitDirChanged = paths.any { it.startsWith("$pathStr$systemSeparator.git$systemSeparator") } if (!areAllPathsIgnored) { _changesNotifier.emit(hasGitDirChanged) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt index 06b4bea..3c0e8ed 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/TabViewModel.kt @@ -279,7 +279,7 @@ class TabViewModel @Inject constructor( } } - suspend fun updateApp(hasGitDirChanged: Boolean) { + private suspend fun updateApp(hasGitDirChanged: Boolean) { if (hasGitDirChanged) { printLog(TAG, "Changes detected in git directory, full refresh")