Added check to prevent staging of empty lists

This commit is contained in:
Abdelilah El Aissaoui 2023-10-29 18:54:59 +01:00
parent 6efef3622b
commit d4d7056341
No known key found for this signature in database
GPG Key ID: 7587FC860F594869

View File

@ -22,6 +22,9 @@ class StageAllUseCase @Inject constructor(
* The setUpdate flag of the addCommand adds deleted files but not newly added when active
*/
private fun addAllExceptNew(git: Git, allExceptNew: List<StatusEntry>) {
if (allExceptNew.isEmpty())
return
val addCommand = git
.add()
@ -35,6 +38,9 @@ class StageAllUseCase @Inject constructor(
}
private fun addNewFiles(git: Git, newFiles: List<StatusEntry>) {
if (newFiles.isEmpty())
return
val addCommand = git
.add()