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
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:
# Initialize git if this is not a normal git directory (e.g. is a worktree)
if [[ "$RUN_IWYU" == true && ! -d .git ]]; then
[[ -e .git || -L .git ]] && mv .git .git-previous
git init
fi
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