Added error when trying to stash a clean workspace
This commit is contained in:
parent
2375f43a44
commit
b2621d2c51
@ -7,7 +7,7 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
class StashChangesUseCase @Inject constructor() {
|
class StashChangesUseCase @Inject constructor() {
|
||||||
suspend operator fun invoke(git: Git, message: String?): Unit = withContext(Dispatchers.IO) {
|
suspend operator fun invoke(git: Git, message: String?): Unit = withContext(Dispatchers.IO) {
|
||||||
git
|
val commit = git
|
||||||
.stashCreate()
|
.stashCreate()
|
||||||
.setIncludeUntracked(true)
|
.setIncludeUntracked(true)
|
||||||
.apply {
|
.apply {
|
||||||
@ -15,5 +15,9 @@ class StashChangesUseCase @Inject constructor() {
|
|||||||
setWorkingDirectoryMessage(message)
|
setWorkingDirectoryMessage(message)
|
||||||
}
|
}
|
||||||
.call()
|
.call()
|
||||||
|
|
||||||
|
if (commit == null) {
|
||||||
|
throw Exception("No changes to stash")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user