Added diff closing to show the log after commiting

This commit is contained in:
Abdelilah El Aissaoui 2021-11-05 04:33:07 +01:00
parent d3633151f7
commit fce9f93df4
2 changed files with 7 additions and 3 deletions

View File

@ -125,7 +125,7 @@ fun RepositoryOpenPage(gitManager: GitManager, dialogManager: DialogManager) {
onCheckoutRef = { ref -> onCheckoutRef = { ref ->
gitManager.checkoutRef(ref) gitManager.checkoutRef(ref)
}, },
onMergeBranch = { ref , fastForward -> onMergeBranch = { ref, fastForward ->
gitManager.mergeBranch(ref, fastForward) gitManager.mergeBranch(ref, fastForward)
}, },
onRevCommitSelected = { commit -> onRevCommitSelected = { commit ->
@ -157,7 +157,10 @@ fun RepositoryOpenPage(gitManager: GitManager, dialogManager: DialogManager) {
UncommitedChanges( UncommitedChanges(
gitManager = gitManager, gitManager = gitManager,
onStagedDiffEntrySelected = { diffEntry -> onStagedDiffEntrySelected = { diffEntry ->
diffSelected = DiffEntryType.StagedDiff(diffEntry) diffSelected = if (diffEntry != null)
DiffEntryType.StagedDiff(diffEntry)
else
null
}, },
onUnstagedDiffEntrySelected = { diffEntry -> onUnstagedDiffEntrySelected = { diffEntry ->
diffSelected = DiffEntryType.UnstagedDiff(diffEntry) diffSelected = DiffEntryType.UnstagedDiff(diffEntry)

View File

@ -37,7 +37,7 @@ import app.theme.headerText
@Composable @Composable
fun UncommitedChanges( fun UncommitedChanges(
gitManager: GitManager, gitManager: GitManager,
onStagedDiffEntrySelected: (DiffEntry) -> Unit, onStagedDiffEntrySelected: (DiffEntry?) -> Unit,
onUnstagedDiffEntrySelected: (DiffEntry) -> Unit, onUnstagedDiffEntrySelected: (DiffEntry) -> Unit,
) { ) {
val stageStatusState = gitManager.stageStatus.collectAsState() val stageStatusState = gitManager.stageStatus.collectAsState()
@ -137,6 +137,7 @@ fun UncommitedChanges(
onClick = { onClick = {
gitManager.commit(commitMessage) gitManager.commit(commitMessage)
commitMessage = "" commitMessage = ""
onStagedDiffEntrySelected(null)
}, },
enabled = commitMessage.isNotEmpty() && staged.isNotEmpty(), enabled = commitMessage.isNotEmpty() && staged.isNotEmpty(),
shape = RectangleShape, shape = RectangleShape,