Fixed FileWatcher triggering status update while an operation is running
This commit is contained in:
parent
cd19a62ae9
commit
23a6b741b8
@ -121,15 +121,16 @@ class GitManager @Inject constructor(
|
|||||||
private suspend fun watchRepositoryChanges() {
|
private suspend fun watchRepositoryChanges() {
|
||||||
val ignored = safeGit.status().call().ignoredNotInIndex.toList()
|
val ignored = safeGit.status().call().ignoredNotInIndex.toList()
|
||||||
|
|
||||||
|
|
||||||
fileChangesWatcher.watchDirectoryPath(
|
fileChangesWatcher.watchDirectoryPath(
|
||||||
pathStr = safeGit.repository.directory.parent,
|
pathStr = safeGit.repository.directory.parent,
|
||||||
ignoredDirsPath = ignored,
|
ignoredDirsPath = ignored,
|
||||||
).collect {
|
).collect {
|
||||||
safeProcessing(showError = false) {
|
if (!_processing.value) { // Only update if there isn't any process running
|
||||||
println("Changes detected, loading status")
|
safeProcessing(showError = false) {
|
||||||
statusManager.loadHasUncommitedChanges(safeGit)
|
println("Changes detected, loading status")
|
||||||
statusManager.loadStatus(safeGit)
|
statusManager.loadHasUncommitedChanges(safeGit)
|
||||||
|
statusManager.loadStatus(safeGit)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,6 +316,7 @@ class GitManager @Inject constructor(
|
|||||||
|
|
||||||
var onRepositoryChanged: (path: String?) -> Unit = {}
|
var onRepositoryChanged: (path: String?) -> Unit = {}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
private suspend fun safeProcessing(showError: Boolean = true, callback: suspend () -> Unit) {
|
private suspend fun safeProcessing(showError: Boolean = true, callback: suspend () -> Unit) {
|
||||||
_processing.value = true
|
_processing.value = true
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user