File tree 2 files changed +21
-2
lines changed
main/kotlin/org/jlleitschuh/gradle/ktlint
test/kotlin/org/jlleitschuh/gradle/ktlint
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -225,10 +225,12 @@ internal fun BaseKtLintCheckTask.applyGitFilter() {
225
225
val projectRelativePath = project.rootDir.toPath()
226
226
.relativize(project.projectDir.toPath())
227
227
.toString()
228
+ .replace(" \\ " , " /" )
229
+
228
230
val filesToInclude = (project.property(FILTER_INCLUDE_PROPERTY_NAME ) as String )
229
- .split(' \n ' )
230
- .filter { it.startsWith(projectRelativePath) }
231
+ .lines()
231
232
.map { it.replace(" \\ " , " /" ) }
233
+ .filter { it.startsWith(projectRelativePath) }
232
234
233
235
if (filesToInclude.isNotEmpty()) {
234
236
include { fileTreeElement ->
Original file line number Diff line number Diff line change @@ -307,6 +307,23 @@ class KtlintPluginTest : AbstractPluginTest() {
307
307
}
308
308
}
309
309
310
+ @DisplayName(" Internal Git filter works with Windows on MINGW" )
311
+ @CommonTest
312
+ @EnabledOnOs(OS .WINDOWS )
313
+ fun gitFilterOnCheckWindowsMingw (gradleVersion : GradleVersion ) {
314
+ project(gradleVersion) {
315
+ withCleanSources()
316
+ withFailingSources()
317
+
318
+ build(
319
+ " :$CHECK_PARENT_TASK_NAME " ,
320
+ " -P$FILTER_INCLUDE_PROPERTY_NAME =src/main/kotlin/CleanSource.kt"
321
+ ) {
322
+ assertThat(task(" :$mainSourceSetCheckTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
323
+ }
324
+ }
325
+ }
326
+
310
327
@DisplayName(" Git filter should respect already applied filters" )
311
328
@CommonTest
312
329
fun gitFilterAlreadyAppliedFilters (gradleVersion : GradleVersion ) {
You can’t perform that action at this time.
0 commit comments