1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

[fix] Do not fail scanning for ChangeDocumentId/TransportRequestId in case of CR/LF

scanning for ChangeDocumentId/TransportRequestId failed when the commit message
used CR/LF as line separator
This commit is contained in:
Marcus Holl 2019-11-22 15:43:48 +01:00
parent 5cec21fe3b
commit 0a53252a5a

View File

@ -48,12 +48,21 @@ String[] extractLogLines(
if(! to?.trim()) throw new IllegalArgumentException('Parameter \'to\' not provided.')
if(! format?.trim()) throw new IllegalArgumentException('Parameter \'format\' not provided.')
sh ( returnStdout: true,
def gitLogLines = sh ( returnStdout: true,
script: """#!/bin/bash
git log --pretty=format:${format} ${from}..${to}
"""
)?.split('\n')
?.findAll { line -> line ==~ /${filter}/ }
// spread not supported here (CPS)
if(gitLogLines) {
def trimmedGitLogLines = []
for(def gitLogLine : gitLogLines) {
trimmedGitLogLines << gitLogLine.trim()
}
return trimmedGitLogLines.findAll { line -> line ==~ /${filter}/ }
}
return new String[0]
}