Log is now updated if uncommited changes status changed

This commit is contained in:
Abdelilah El Aissaoui 2021-10-15 14:10:59 +02:00
parent eef36cf53c
commit cc2a7e180f

View File

@ -122,12 +122,21 @@ class GitManager @Inject constructor(
fun loadLog() = managerScope.launch { fun loadLog() = managerScope.launch {
coLoadLog() coLoadLog()
} }
private suspend fun coLoadLog(){
private suspend fun coLoadLog() {
logManager.loadLog(safeGit) logManager.loadLog(safeGit)
} }
suspend fun loadStatus() { suspend fun loadStatus() {
val hadUncommitedChanges = statusManager.hasUncommitedChanges.value
statusManager.loadStatus(safeGit) statusManager.loadStatus(safeGit)
val hasNowUncommitedChanges = statusManager.hasUncommitedChanges.value
// Update the log only if the uncommitedChanges status has changed
if (hasNowUncommitedChanges != hadUncommitedChanges)
coLoadLog()
} }
fun stage(diffEntry: DiffEntry) = managerScope.launch { fun stage(diffEntry: DiffEntry) = managerScope.launch {
@ -153,14 +162,14 @@ class GitManager @Inject constructor(
fun pull() = managerScope.launch { fun pull() = managerScope.launch {
safeProcessing { safeProcessing {
remoteOperationsManager.pull(safeGit) remoteOperationsManager.pull(safeGit)
logManager.loadLog(safeGit) coLoadLog()
} }
} }
fun push() = managerScope.launch { fun push() = managerScope.launch {
safeProcessing { safeProcessing {
remoteOperationsManager.push(safeGit) remoteOperationsManager.push(safeGit)
logManager.loadLog(safeGit) coLoadLog()
} }
} }