Skip to content

ci: use three-dot diff to isolate PR branch changes in lint check - #14366

Merged
lqiu96 merged 1 commit into
mainfrom
fix-kokoro-build-lint-diff
Sep 14, 2026
Merged

ci: use three-dot diff to isolate PR branch changes in lint check#14366
lqiu96 merged 1 commit into
mainfrom
fix-kokoro-build-lint-diff

Conversation

@lqiu96

@lqiu96 lqiu96 commented Sep 11, 2026

Copy link
Copy Markdown
Member

In .kokoro/build.sh, changed_file_list used a two-dot git diff (${BASE_SHA} ${HEAD_SHA}), which compares BASE_SHA directly to HEAD_SHA. When BASE_SHA moves ahead on main after the PR branch diverges, files merged into main on other modules were erroneously included in the diff.

Switch to a three-dot git diff (${BASE_SHA}...${HEAD_SHA}) to diff against the merge base between BASE_SHA and HEAD_SHA, matching .kokoro/common.sh get_modified_files() behavior.

Logs from lint job in #14354 which only touched a spanner file:

java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryArrowArray.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryArrowResultSet.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryArrowStruct.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryBaseArray.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryBaseStruct.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryStatement.java
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryTemporalUtility.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryArrowArrayOfPrimitivesTest.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryArrowResultSetTest.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryArrowStructTest.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcCustomLoggerTest.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryStatementTest.java
java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryTemporalUtilityTest.java
java-spanner/samples/snippets/src/main/java/com/example/spanner/QueueSample.java
Matched: java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryArrowArray.java
Changed Modules: java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc java-bigquery-jdbc
Formatting only changed modules: java-bigquery-jdbc

In .kokoro/build.sh, changed_file_list used a two-dot git diff (${BASE_SHA} ${HEAD_SHA}), which compares BASE_SHA directly to HEAD_SHA. When BASE_SHA moves ahead on main after the PR branch diverges, files merged into main on other modules were erroneously included in the diff.

Switch to a three-dot git diff (${BASE_SHA}...${HEAD_SHA}) to diff against the merge base between BASE_SHA and HEAD_SHA, matching .kokoro/common.sh get_modified_files() behavior.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the .kokoro/build.sh script to use a triple-dot diff syntax between BASE_SHA and HEAD_SHA, ensuring the diff is calculated from their common ancestor. There are no review comments, and I have no feedback to provide.

@lqiu96
lqiu96 requested a review from blakeli0 September 14, 2026 16:54
@lqiu96
lqiu96 marked this pull request as ready for review September 14, 2026 16:54
@lqiu96
lqiu96 requested review from a team as code owners September 14, 2026 16:54
@lqiu96
lqiu96 merged commit 2b0bde8 into main Sep 14, 2026
196 checks passed
@lqiu96
lqiu96 deleted the fix-kokoro-build-lint-diff branch September 14, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants