#!/usr/bin/env bash # Feeds the chunker of the earlier code-review-bot module a diff whose added line starts with "++". Writes output/21. set -euo pipefail cd "$(dirname "$0")/.." OUT=target/earlier-bot mkdir -p $OUT cat > $OUT/Probe.java <<'JAVA' import com.ankurm.reviewbot.DiffChunker; public class Probe { public static void main(String[] args) { String diff = "diff --git a/x.sql b/x.sql\n--- a/x.sql\n+++ b/x.sql\n@@ -1,2 +1,4 @@\n select 1;\n+++i;\n+select 2;\n select 3;\n"; for (var chunk : new DiffChunker(2000).chunk(diff).chunks()) { System.out.print(chunk.text()); System.out.println("added lines: " + chunk.addedLines()); } } } JAVA javac -d $OUT ../code-review-bot/src/main/java/com/ankurm/reviewbot/DiffChunker.java $OUT/Probe.java { echo "new file content is: select 1; / ++i; / select 2; / select 3; (added: lines 2 and 3)" echo "code-review-bot DiffChunker says:" java -cp $OUT Probe } > output/21-earlier-bot-chunker.txt cat output/21-earlier-bot-chunker.txt