Commit Graph

5 Commits (ce6c4ddeb51e637b9eb758a0a407911b4414ac77)

Author SHA1 Message Date
ruevs bb7a6cbbba Revert "CMake: use git rev-parse to get GIT_COMMIT_HASH"
This reverts commit f1e47e6554.
Since unfortunately it breaks the addition of the git commit hash
to the version string when building from the VisualStudio IDE.
I presume this happens because `git` is not of the "path" of the
build environment. The version string ends up "3.0~" only.
2022-01-16 13:08:07 -05:00
herrgahr f1e47e6554 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
2022-01-11 09:56:55 -05:00
whitequark e7b75f19c3 Revert "CMake: replace GetGitCommitHash with .gitattributes and $Id$."
This reverts commit c962357b35.

$Id$ inserts the SHA1 of the *blob*, not the *commit*, and is
therefore completely worthless.
2019-05-01 08:32:59 +00:00
whitequark c962357b35 CMake: replace GetGitCommitHash with .gitattributes and $Id$. 2019-02-10 09:41:11 +00:00
whitequark 2fed0587ea Embed git commit hash in the "About" dialog.
Also, remove usage of __DATE__ and __TIME__ to make the build fully
deterministic. They are redundant once we have the commit hash,
anyway.
2016-04-23 22:53:21 +00:00