moonchen opened a new pull request, #13302: URL: https://github.com/apache/trafficserver/pull/13302
### Problem In a linked `git worktree`, `cmake --build build -t format` and the pre-commit hook fail with `No clang-format found`. `tools/clang-format.sh` resolves its download/cache directory with `git rev-parse --absolute-git-dir`, which in a worktree is the per-worktree git dir (`.git/worktrees/<name>`), not the shared `.git`. clang-format is installed once under the common dir, so the worktree looks in the wrong, empty place. ### Fix Resolve the **common** git dir, which is shared by all worktrees — the same thing `CMakeLists.txt` already does to compute `GIT_COMMON_DIR`, so the script and CMake now agree on the cache location. `--git-common-dir` can return a relative path, so it is made absolute with `cd … && pwd`. I deliberately avoided `git rev-parse --path-format=absolute --git-common-dir`: that exact form was removed in #11495 for a cmake 3.28 incompatibility (it needs git 2.31+). This restores the worktree support originally added in #11015 *without* reverting the #11495 fix. Only `clang-format.sh` is affected — `yapf.sh`/`cmake-format.sh` now use `uv` and no longer cache under the git dir. ### Testing (git 2.43.0, cmake 3.28.3) - Main checkout: pre-commit hook and format target behave as before. - Linked worktree, with the binary installed only under the common `.git/fmt`: the pre-commit hook now finds clang-format and commits succeed (previously `No clang-format found`) — verified end-to-end with the `clangFormat.binary` fallback removed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
