|
21 | 21 | package com.dropbox.affectedmoduledetector |
22 | 22 |
|
23 | 23 | import com.dropbox.affectedmoduledetector.commitshaproviders.CommitShaProvider |
| 24 | +import com.dropbox.affectedmoduledetector.util.toOsSpecificLineEnding |
| 25 | +import com.dropbox.affectedmoduledetector.util.toOsSpecificPath |
| 26 | +import org.gradle.api.logging.Logger |
24 | 27 | import java.io.File |
25 | 28 | import java.util.concurrent.TimeUnit |
26 | | -import org.gradle.api.logging.Logger |
27 | 29 |
|
28 | 30 | interface GitClient { |
29 | 31 | fun findChangedFiles( |
@@ -83,11 +85,13 @@ internal class GitClientImpl( |
83 | 85 | val sha = commitShaProvider.get(commandRunner) |
84 | 86 |
|
85 | 87 | // use this if we don't want local changes |
86 | | - return commandRunner.executeAndParse(if (includeUncommitted) { |
87 | | - "$CHANGED_FILES_CMD_PREFIX $sha" |
88 | | - } else { |
89 | | - "$CHANGED_FILES_CMD_PREFIX $top..$sha" |
90 | | - }) |
| 88 | + return commandRunner.executeAndParse( |
| 89 | + if (includeUncommitted) { |
| 90 | + "$CHANGED_FILES_CMD_PREFIX $sha" |
| 91 | + } else { |
| 92 | + "$CHANGED_FILES_CMD_PREFIX $top..$sha" |
| 93 | + } |
| 94 | + ) |
91 | 95 | } |
92 | 96 |
|
93 | 97 | private fun findGitDirInParentFilepath(filepath: File): File? { |
@@ -168,12 +172,10 @@ internal class GitClientImpl( |
168 | 172 | } |
169 | 173 |
|
170 | 174 | override fun executeAndParse(command: String): List<String> { |
171 | | - val response = execute(command) |
| 175 | + return execute(command).toOsSpecificLineEnding() |
172 | 176 | .split(System.lineSeparator()) |
173 | | - .filterNot { |
174 | | - it.isEmpty() |
175 | | - } |
176 | | - return response |
| 177 | + .map { it.toOsSpecificPath() } |
| 178 | + .filterNot { it.isEmpty() } |
177 | 179 | } |
178 | 180 |
|
179 | 181 | override fun executeAndParseFirst(command: String): String { |
|
0 commit comments