ci: Allow running iwyu CI in worktree #34441

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2601-ci-iwyu-worktree changing 1 files +13 −0
  1. maflcko commented at 9:21 am on January 29, 2026: member

    Currently, the iwyu CI fails to run in a git-worktree, or git-archive. This is due to the use of git diff.

    Fix this by force-initializing a dummy git repo with a single dummy commit.

    It may be possible to detect when git diff is not available in the directory, and only apply the fallback when needed, but the git history is not needed and it is easier to unconditionally apply the git init.

  2. DrahtBot added the label Tests on Jan 29, 2026
  3. DrahtBot commented at 9:22 am on January 29, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. maflcko force-pushed on Jan 29, 2026
  5. DrahtBot added the label CI failed on Jan 29, 2026
  6. DrahtBot commented at 9:32 am on January 29, 2026: contributor

    🚧 At least one of the CI tasks failed. Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/21472570144/job/61848516389 LLM reason (✨ experimental): IWYU reported a failure in the CI run.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  7. DrahtBot removed the label CI failed on Jan 29, 2026
  8. ci: Allow running iwyu ci in worktree aaaa717266
  9. in ci/test/03_test_script.sh:52 in 88887114b8
    43@@ -44,6 +44,19 @@ echo "=== BEGIN env ==="
    44 env
    45 echo "=== END env ==="
    46 
    47+if [[ "${RUN_IWYU}" == true ]]; then
    48+  # The CI framework should be flexible where it is run from. For example, from
    49+  # a git-archive, a git-worktree, or a normal git repo.
    50+  # The iwyu task requires a working git repo, which may not always be
    51+  # available, so initialize one with force.
    52+  rm -rf .git
    


    ryanofsky commented at 8:29 pm on January 30, 2026:

    In commit “ci: Allow running iwyu ci in worktree” (88887114b89de6642197fce8afd005172f8bc260)

    This seems dangerous. It should be safe to run ci commands locally without expecting your git history to be wiped away. Would suggest a tweak like:

    0# Initialize git if this is not a normal git directory (e.g. is a worktree)
    1if [[ "$RUN_IWYU" == true && ! -d .git ]]; then
    2  [[ -e .git || -L .git ]] && mv .git .git-previous
    3  git init
    4fi
    

    maflcko commented at 9:02 am on January 31, 2026:

    I’d doubt that this script will pass at all when run locally and it is not designed to be used that way. Maybe there should be a check in the beginning, with an early abort if DANGER_RUN_CI_ON_HOST is not set?

    In any case, I’ve replaced this line with mv .git .git_ci_backup || true

  10. maflcko force-pushed on Jan 31, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-02-02 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me