fix(axbuild): infer diff base for zero since ref#1143
Merged
Conversation
Contributor
There was a problem hiding this comment.
Review Summary
PR 做了什么
当新创建的远程分支首次触发 push CI 时,GitHub Actions 会将 github.event.before 设为全零 SHA。旧代码会直接 bail 并退回全量 workspace clippy。本 PR 教 axbuild 的 git helper 识别零 since ref,从本地 git graph 推断增量 diff base,并复用推断出的 base 来正确检测根 Cargo.toml 变更。
实现分析
changed_paths_since→changed_paths_since_with_base重构很干净,让select_incremental_packages能使用推断出的 diff base 而非原始零 SHA 来检查root_manifest_change_since。infer_zero_since_diff_base通过git rev-list --reverse --parents HEAD --not <remote-refs>找到当前分支第一个独有的 commit,取其 parent 作为 diff base,逻辑正确。git_remote_refs_not_at_commit只查refs/remotes,在 CI push 场景下足够。- 错误处理全面,context 信息清晰。
测试覆盖
zero_since_on_new_branch_resolves_to_first_unique_parent:基本场景zero_since_ignores_default_branch_tip_after_branch_fork:dev 在 fork 后有新 commit 的场景zero_since_root_manifest_change_uses_inferred_base:端到端测试,验证select_incremental_packages在零 since 下正确检测Cargo.toml变更zero_since_without_remote_refs_returns_error:无 remote ref 时的降级行为
CI 状态
Clippy (run_host) ✅ | Test starry riscv64 qemu (run_container) ✅ | Test arceos aarch64 qemu (run_host) ✅ | Test arceos riscv64 qemu (run_host) ✅ | Test starry self-hosted board orangepi-5-plus (run_host) ✅。skipped jobs 是 run_host/run_container 矩阵互斥的预期行为。
重复分析
无重叠 open PR。#1160 (Wayland)、#1159 (CI dedupe) 与本 PR 改动的 scripts/axbuild/src/support/git.rs 无关。
本地验证
cargo fmt --check✅cargo clippy --all-features -- -D warnings✅cargo test -- support::git22/22 通过 ✅(含 4 个新增测试)
结论:代码逻辑正确、测试覆盖充分、CI 全部通过、无阻塞问题。APPROVE。
Powered by mimo-v2.5-pro
Merged
aptacc2421
pushed a commit
to aptacc2421/tgoskits
that referenced
this pull request
Jun 14, 2026
luodeb
pushed a commit
that referenced
this pull request
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a newly created remote branch triggers a
pushCI run for the first time, GitHub Actions setsgithub.event.beforeto the all-zero SHA. The CI passes that value tocargo xtask clippy --since, so the incremental diff base cannot be resolved and the check falls back to a full workspace run.Changes
axbuildgit helper to recognize an all-zero--sinceref.Cargo.tomlchanges, so zero-since runs do not try to read old files from the all-zero ref.Cargo.tomlchanges, and inference fallback.