diff options
author | Jason Penilla <[email protected]> | 2024-04-23 14:26:28 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-04-23 14:26:28 -0700 |
commit | 9cac5b6f4f1db5165a50b1bbdc00d51172213695 (patch) | |
tree | d55bc3196fd6b50c1e1915e88cbcbde51a8c85b0 /build.gradle.kts | |
parent | eb41348d3970959a55ca28a9704a6f8e3f9d296a (diff) | |
download | Paper-9cac5b6f4f1db5165a50b1bbdc00d51172213695.tar.gz Paper-9cac5b6f4f1db5165a50b1bbdc00d51172213695.zip |
Fix continueServerUpdate with 2-line subjects
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 1c49486c94..ecfc0abe25 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -194,6 +194,7 @@ abstract class RebasePatches : BaseTask() { companion object { val regex = Pattern.compile("Patch failed at ([0-9]{4}) (.*)") + val continuationRegex = Pattern.compile("^\\s{1}.+\$") const val subjectPrefix = "Subject: [PATCH] " } @@ -223,8 +224,19 @@ abstract class RebasePatches : BaseTask() { val failedSubjectFragment = matcher.group(2) val failed = unapplied.single { p -> p.useLines { lines -> - val subjectLine = lines.single { it.startsWith(subjectPrefix) } - .substringAfter(subjectPrefix) + val collect = mutableListOf<String>() + for (line in lines) { + if (line.startsWith(subjectPrefix)) { + collect += line + } else if (collect.size == 1) { + if (continuationRegex.matcher(line).matches()) { + collect += line + } else { + break + } + } + } + val subjectLine = collect.joinToString("").substringAfter(subjectPrefix) subjectLine.startsWith(failedSubjectFragment) } } |