Fixed .git dir changes not being detected properly and added rule to ignore .proble files in git dir
This commit is contained in:
parent
1d40964c17
commit
7e6ccbe810
@ -36,7 +36,7 @@ pub fn watch_directory(
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if e != RecvTimeoutError::Timeout {
|
if e != RecvTimeoutError::Timeout {
|
||||||
println!("Watch error: {:?}", e)
|
println!("Watch error: {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,18 +48,21 @@ class FileChangesWatcher @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val areAllPathsIgnored = paths.all { path ->
|
val areAllPathsIgnored = paths.all { path ->
|
||||||
val matchesAnyRule = ignoreRules.any { rule ->
|
val matchesAnyIgnoreRule = ignoreRules.any { rule ->
|
||||||
rule.isMatch(path, Files.isDirectory(Paths.get(path)))
|
rule.isMatch(path, Files.isDirectory(Paths.get(path)))
|
||||||
}
|
}
|
||||||
|
|
||||||
val isGitIgnoredFile = gitDirIgnoredFiles.any { ignoredFile ->
|
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) {
|
if (!areAllPathsIgnored) {
|
||||||
_changesNotifier.emit(hasGitDirChanged)
|
_changesNotifier.emit(hasGitDirChanged)
|
||||||
|
@ -279,7 +279,7 @@ class TabViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun updateApp(hasGitDirChanged: Boolean) {
|
private suspend fun updateApp(hasGitDirChanged: Boolean) {
|
||||||
if (hasGitDirChanged) {
|
if (hasGitDirChanged) {
|
||||||
printLog(TAG, "Changes detected in git directory, full refresh")
|
printLog(TAG, "Changes detected in git directory, full refresh")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user