The format (clang-format-19, changed lines) job in ci.yml resolves its base as origin/${{ github.base_ref }} and runs git clang-format ... "$base". That is master's tip at job time, not the branch's merge base, so once master moves ahead of the PR branch the comparison also picks up the reverse of whatever landed in between. If any of those commits touched C, the job reports the PR as not clang-format-clean and prints a diff of code the PR never touched.
Hit twice in a row on #796, whose diff contains no C at all. The first failure quoted src/htscache.c (from #776, landed mid-run); after merging master the job failed again quoting src/htscore.c (from #783, landed during that run). Locally, git-clang-format-19 --binary clang-format-19 --diff origin/master on the same branch reports no modified files to format whenever the branch is level with master.
The busier master is, the likelier the false failure, and the only workaround today is to keep merging master until a run happens to fit in the gap.
Fix is to compare against the merge base:
base="$(git merge-base "origin/${{ github.base_ref }}" HEAD)"
actions/checkout already fetches with fetch-depth: 0, so the merge base is available. Same trap applies to any other job that diffs against origin/master rather than the merge base.
The
format (clang-format-19, changed lines)job inci.ymlresolves its base asorigin/${{ github.base_ref }}and runsgit clang-format ... "$base". That is master's tip at job time, not the branch's merge base, so once master moves ahead of the PR branch the comparison also picks up the reverse of whatever landed in between. If any of those commits touched C, the job reports the PR as not clang-format-clean and prints a diff of code the PR never touched.Hit twice in a row on #796, whose diff contains no C at all. The first failure quoted
src/htscache.c(from #776, landed mid-run); after merging master the job failed again quotingsrc/htscore.c(from #783, landed during that run). Locally,git-clang-format-19 --binary clang-format-19 --diff origin/masteron the same branch reportsno modified files to formatwhenever the branch is level with master.The busier master is, the likelier the false failure, and the only workaround today is to keep merging master until a run happens to fit in the gap.
Fix is to compare against the merge base:
actions/checkoutalready fetches withfetch-depth: 0, so the merge base is available. Same trap applies to any other job that diffs againstorigin/masterrather than the merge base.