File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -315,8 +315,14 @@ void checkE2EIgnoreFiles() {
315315 echo " This is the first run. Using merge base as the starting point for the diff."
316316 changedFiles = sh(script : " git diff --name-only \$ (git merge-base HEAD origin/$CHANGE_TARGET )" , returnStdout : true ). trim(). split(' \n ' ). findAll{it}
317317 } else {
318- echo " Processing changes since last processed commit: $lastProcessedCommitHash "
319- changedFiles = sh(script : " git diff --name-only $lastProcessedCommitHash HEAD" , returnStdout : true ). trim(). split(' \n ' ). findAll{it}
318+ def commitExists = sh(script : " git cat-file -e $lastProcessedCommitHash 2>/dev/null" , returnStatus : true ) == 0
319+ if (commitExists) {
320+ echo " Processing changes since last processed commit: $lastProcessedCommitHash "
321+ changedFiles = sh(script : " git diff --name-only $lastProcessedCommitHash HEAD" , returnStdout : true ). trim(). split(' \n ' ). findAll{it}
322+ } else {
323+ echo " Commit hash $lastProcessedCommitHash does not exist in the current repository. Using merge base as the starting point for the diff."
324+ changedFiles = sh(script : " git diff --name-only \$ (git merge-base HEAD origin/$CHANGE_TARGET )" , returnStdout : true ). trim(). split(' \n ' ). findAll{it}
325+ }
320326 }
321327
322328 echo " Excluded files: $excludedFiles "
You can’t perform that action at this time.
0 commit comments