Fixed uncommited changes line not appearing on rebase with a single conflict (no other changes)

This commit is contained in:
Abdelilah El Aissaoui 2022-04-06 20:18:59 +02:00
parent 51ea75c033
commit 7f9da646ff
3 changed files with 23 additions and 4 deletions

View file

@ -292,11 +292,13 @@ class StatusManager @Inject constructor(
val addedCount = changesGrouped[StatusType.ADDED].countOrZero()
val modifiedCount = changesGrouped[StatusType.MODIFIED].countOrZero()
val conflictingCount = changesGrouped[StatusType.CONFLICTING].countOrZero()
return StatusSummary(
modifiedCount = modifiedCount,
deletedCount = deletedCount,
addedCount = addedCount,
conflictingCount = conflictingCount,
)
}
@ -338,4 +340,14 @@ enum class StatusType {
CONFLICTING,
}
data class StatusSummary(val modifiedCount: Int, val deletedCount: Int, val addedCount: Int)
data class StatusSummary(
val modifiedCount: Int,
val deletedCount: Int,
val addedCount: Int,
val conflictingCount: Int,
) {
val total = modifiedCount +
deletedCount +
addedCount +
conflictingCount
}

View file

@ -590,6 +590,14 @@ fun LogStatusSummary(statusSummary: StatusSummary, modifier: Modifier) {
color = MaterialTheme.colors.deleteFile,
)
}
if (statusSummary.conflictingCount > 0) {
SummaryEntry(
count = statusSummary.conflictingCount,
icon = Icons.Default.Warning,
color = MaterialTheme.colors.conflictFile,
)
}
}
}

View file

@ -58,8 +58,7 @@ class LogViewModel @Inject constructor(
git = git,
)
val hasUncommitedChanges =
statusSummary.addedCount + statusSummary.deletedCount + statusSummary.modifiedCount > 0
val hasUncommitedChanges = statusSummary.total > 0
val log = logManager.loadLog(git, currentBranch, hasUncommitedChanges)
_logStatus.value = LogStatus.Loaded(hasUncommitedChanges, log, currentBranch, statusSummary)
@ -162,7 +161,7 @@ class LogViewModel @Inject constructor(
git = git,
)
} else
StatusSummary(0, 0, 0)
StatusSummary(0, 0, 0, 0)
val previousLogStatusValue = _logStatus.value