Rebase interactive is aborted when something fails during the process
This commit is contained in:
parent
f124d1fb9e
commit
cb3fe17fee
@ -50,11 +50,15 @@ class RebaseManager @Inject constructor(
|
||||
|
||||
suspend fun rebaseInteractive(git: Git, interactiveHandler: InteractiveHandler, commit: RevCommit) {
|
||||
//TODO Check possible rebase errors by checking the result
|
||||
git.rebase()
|
||||
val rebaseResult = git.rebase()
|
||||
.runInteractively(interactiveHandler)
|
||||
.setOperation(RebaseCommand.Operation.BEGIN)
|
||||
.setUpstream(commit)
|
||||
.call()
|
||||
|
||||
if (rebaseResult.status == RebaseResult.Status.FAILED) {
|
||||
throw UncommitedChangesDetectedException("Rebase interactive failed.")
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun rebaseLinesFullMessage(
|
||||
|
@ -75,12 +75,18 @@ class RebaseInteractiveViewModel @Inject constructor(
|
||||
|
||||
suspend fun startRebaseInteractive(revCommit: RevCommit) = tabState.runOperation(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
showError = true
|
||||
) { git ->
|
||||
try {
|
||||
rebaseManager.rebaseInteractive(git, interactiveHandler, revCommit)
|
||||
completed = true
|
||||
} catch (ex: RebaseCancelledException) {
|
||||
println("Rebase cancelled")
|
||||
} catch (ex: Exception) {
|
||||
if(ex is RebaseCancelledException) {
|
||||
println("Rebase cancelled")
|
||||
} else {
|
||||
cancel()
|
||||
throw ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user