Skip to content

Commit fd7d30d

Browse files
Fix issues when doing rdeps query with spaces
Fixes an issue when querying via rdeps with targets that include a space character
1 parent 79d93fc commit fd7d30d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/bazel_diff/BazelClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public List<BazelTarget> queryAllTargets() throws IOException {
4848
@Override
4949
public Set<String> queryForImpactedTargets(Set<String> impactedTargets, String avoidQuery) throws IOException {
5050
Set<String> impactedTargetNames = new HashSet<>();
51-
String targetQuery = impactedTargets.stream().collect(Collectors.joining(" + "));
51+
String targetQuery = impactedTargets.stream()
52+
.map(target -> String.format("'%s'", target))
53+
.collect(Collectors.joining(" + "));
5254
String query = String.format("rdeps(//..., %s)", targetQuery);
5355
if (avoidQuery != null) {
5456
query = String.format("(%s) except (%s)", query, avoidQuery);

0 commit comments

Comments
 (0)