Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: use git rev-parse to get GIT_COMMIT_HASH
The old approach of reading .git/HEAD does not work when using git worktrees, where the folder layout looks roughly like: solvespace.git/ - bare clone (.git dir) solvespace.git/work - example worktree containing master solvespage.git/worktrees/work/ - .git dir of worktree solvespage.git/worktrees/work/HEAD - actual HEAD ref for master First attempt was to just get GIT_ROOT from `git rev-parse --git-dir` but that wasn't enough, since: 1. GIT_ROOT points to solvespage.git/worktrees/work/ 2. GIT_ROOT/HEAD points to refs/heads/master 3. GIT_ROOT/refs/heads/master does not exist but the old implementation would want to use this to get the sha so we need two invocations of git rev-parse 1. `git rev-parse --git-dir` to get GIT_DIR needed for setting GIT_DEPENDS 2. `git rev-parse HEAD` to get the sha of the worktree's HEAD
- Loading branch information