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