Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake fails after git gc #874

Closed
redstar opened this issue Mar 28, 2015 · 1 comment
Closed

CMake fails after git gc #874

redstar opened this issue Mar 28, 2015 · 1 comment

Comments

@redstar
Copy link
Member

redstar commented Mar 28, 2015

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. The only challenge is how to run these commands at every build (like the original implementation).

redstar added a commit that referenced this issue Mar 28, 2015
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).
redstar added a commit that referenced this issue Mar 28, 2015
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`.
@redstar
Copy link
Member Author

redstar commented Apr 1, 2015

I created an upstream pull for this: rpavlik/cmake-modules#34
The solution might not be perfect but works for me.

@redstar redstar closed this as completed Apr 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant