Commit graph

3 commits

Author SHA1 Message Date
Kai Nacke
7c835c2738 2nd try at issue #874.
The problem from issue #874 has another variant:
If .git/logs/refs/heads/merge-2.067 exists then this ref is
returned as hash value(!). This is plain wrong. Solution is
again to look up `.git/packed-refs`.
2015-03-28 19:01:48 +01:00
kai
3a6d7bad96 Fix for issue #874.
After running `git gc` cmake may fail to configure the build.
`git gc` deleted the file `.git/refs/head/merge-2.067` (my current branch) and
moved the reference into file `.git/packed-refs`. This file is not parsed for
the reference.

Solution is (a) parse `.git/packed-refs` if ref is not found or (b) use

    git rev-parse --symbolic-full-name HEAD

to get the reference and

    git show-ref --hash ${HEAD_REF}

to get the hash.

This commits uses solution (a).
2015-03-28 18:20:45 +01:00
kai
aa143b560c Include Git revision in version info.
CMakeLists.txt contains now the version numbers for DMD and (next) LDC release.
If a .git folder is found then the LDC version is replaced by the first 6 chars
of the Git revision.

Possible improvements:

- If the build is not done at the master branch then it could be useful to check for a tag and use the tag instead of the revision. (for release builds)
- Maybe it is useful to include the branch name.

This fixes issue #366.
2013-06-21 06:47:32 +02:00