From 59de2f358ab7ec46e2c1b5a7f4790699d35c3cee Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Sat, 15 Jun 2024 01:06:50 +0200 Subject: [PATCH] Fixed rebase interactive taking the wrong message Fixes #165 --- .../gitnuro/viewmodels/StatusViewModel.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt index be68806c..cb2a3614 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/StatusViewModel.kt @@ -301,9 +301,17 @@ class StatusViewModel @Inject constructor( private fun messageByRepoState(git: Git): String { val message: String? = - if ( + if (git.repository.repositoryState.isRebasing) { + val rebaseMergeDir = File(git.repository.directory, "rebase-merge") + val messageFile = File(rebaseMergeDir, "message") + + if (messageFile.exists()) { + runCatching { messageFile.readText() }.getOrNull() ?: "" + } else { + "" + } + } else if ( git.repository.repositoryState.isMerging || - git.repository.repositoryState.isRebasing || git.repository.repositoryState.isReverting || git.repository.repositoryState.isCherryPicking ) {