diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 811d072..7e065d5 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -249,13 +249,16 @@ def gitsparserestore(String targetDir) { def List convertSparseItemsString(String itemstopublish) { def List sparsepaths = [] - def String[] items = itemstopublish.split(',') - def String allpaths = "" - for(String item : items) { - sparsepaths.add(item) - allpaths += "${item}\n" + boolean nonempty = itemstopublish?.trim() + if (nonempty) { + def String[] items = itemstopublish..trim().split(',') + def String allpaths = "" + for(String item : items) { + sparsepaths.add(item) + allpaths += "${item}\n" + } + echo "Selected item to publish:\n${allpaths}" } - echo "Selected item to publish:\n${allpaths}" return sparsepaths }