Added error when trying to stash a clean workspace

This commit is contained in:
Abdelilah El Aissaoui 2024-06-23 14:57:21 +02:00
parent 2375f43a44
commit b2621d2c51
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -7,7 +7,7 @@ import javax.inject.Inject
class StashChangesUseCase @Inject constructor() {
suspend operator fun invoke(git: Git, message: String?): Unit = withContext(Dispatchers.IO) {
git
val commit = git
.stashCreate()
.setIncludeUntracked(true)
.apply {
@ -15,5 +15,9 @@ class StashChangesUseCase @Inject constructor() {
setWorkingDirectoryMessage(message)
}
.call()
if (commit == null) {
throw Exception("No changes to stash")
}
}
}