Fix for REUSE scanning merge commits in omec repos

Change-Id: Ia3aa15857b400d89398b560e58eb65bd9e8c261b
diff --git a/jjb/pipeline/omec-reuse-scan.groovy b/jjb/pipeline/omec-reuse-scan.groovy
index 6b471ab..ade6f6e 100644
--- a/jjb/pipeline/omec-reuse-scan.groovy
+++ b/jjb/pipeline/omec-reuse-scan.groovy
@@ -49,20 +49,26 @@
 
         stage("Run REUSE Linter"){
             steps {
-                sh  """
+                sh  '''
                     #!/usr/bin/env bash
 
-                    cd ${params.project}
+                    cd $project
                     git checkout FETCH_HEAD
                     git show
 
                     mkdir ../jenkins-license-scan
-                    cp --parents $(git diff-tree --no-commit-id --name-only -r HEAD) ../jenkins-license-scan
-                    cd ../jenkins-license-scan
+                    modifiedFiles=$(git diff-tree --no-commit-id --name-only -r HEAD)
+                    if [ -n "$modifiedFiles" ]
+                    then
+                        cp --parents "$modifiedFiles" ../jenkins-license-scan
+                        cd ../jenkins-license-scan
 
-                    reuse download --all
-                    reuse lint
-                    """
+                        reuse download --all
+                        reuse lint
+                    else
+                        echo "There were no files to check. Skipping REUSE scan."
+                    fi
+                    '''
             }
         }
     }