[PATCH] D79400: [CMAKE] Fix build failure when source directory is read only

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 00:09:12 PDT 2020


phosek added a comment.
Herald added a reviewer: MaskRay.

@scott.linder is actually correct, the reason we write the file is precisely as he described in https://reviews.llvm.org/D79400#2021255. When you use tools like `repo` which branchless checkout, `.git/logs/HEAD` won't exist on initial checkout, but we want to detect changes to it later. It's not true that `.git/logs/HEAD` isn't used, see for example in clang/lib/Basic/CMakeLists.txt on line 24, while the header is being generated by the `GenerateVersionFromVCS.cmake` script, whether that script is executed is controlled by a dependency on `.git/logs/HEAD`, if `.git/logs/HEAD` doesn't change we won't rerun that script. The reason we do this rather than calling `.git/logs/HEAD` directly is to avoid running `git rev-parse HEAD` on every build invocation. The reason we depend on ``.git/logs/HEAD` and not `.git/HEAD` is because the latter may only contain symbolic information and so won't change e.g. on rebase whereas the former will, in which case we want to regenerate the header. I agree that the Subversion part of `find_first_existing_vc_file` could be removed now. We also don't need to check Clang or LLD source tree separately from LLVM now that everything is in one repo, but the logic for determining Git revision should be still correct.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79400/new/

https://reviews.llvm.org/D79400





More information about the llvm-commits mailing list