-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed pull result not being shown properly
Also fixed pull from specific branch using merge by default instead of the user's configuration
- Loading branch information
1 parent
169ed5a
commit e5899d0
Showing
6 changed files
with
66 additions
and
69 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ain/kotlin/com/jetpackduba/gitnuro/git/remote_operations/HasPullResultConflictsUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.jetpackduba.gitnuro.git.remote_operations | ||
|
||
import org.eclipse.jgit.api.MergeResult | ||
import org.eclipse.jgit.api.PullResult | ||
import org.eclipse.jgit.api.RebaseResult | ||
import javax.inject.Inject | ||
|
||
typealias PullHasConflicts = Boolean | ||
|
||
class HasPullResultConflictsUseCase @Inject constructor() { | ||
operator fun invoke(isRebase: Boolean, pullResult: PullResult): PullHasConflicts { | ||
if (!pullResult.isSuccessful) { | ||
if ( | ||
pullResult.mergeResult?.mergeStatus == MergeResult.MergeStatus.CONFLICTING || | ||
pullResult.rebaseResult?.status == RebaseResult.Status.CONFLICTS || | ||
pullResult.rebaseResult?.status == RebaseResult.Status.STOPPED | ||
) { | ||
return true | ||
} | ||
|
||
if (isRebase) { | ||
val message = when (pullResult.rebaseResult.status) { | ||
RebaseResult.Status.UNCOMMITTED_CHANGES -> "The pull with rebase has failed because you have got uncommitted changes" | ||
else -> "Pull failed" | ||
} | ||
|
||
throw Exception(message) | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/kotlin/com/jetpackduba/gitnuro/viewmodels/MenuViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters