rpavlik/cmake-modules

git gc --aggressive and prune deletes all refs and logs

Closed this issue · 2 comments

Hi,

There are 2 issues with GetGitRevisionDescription.cmake.in

  1. If only the logs folder exists than the hash = reference.
  2. gc and prune delete refs folder and logs/refs and the script is crashing.

Cheers
Alina

What lines are causing the error? I suspect it's presumably my efforts to get this to work nicely without having to shell out to Git, so the workaround might be to check for expected failure and call Git instead in those cases.

Hi,

Sorry for not posting a more detailed report, I was in a hurry.
If you look into GetGitRevisionDescription.cmake.in when it is trying to retreive the hash for a branch it is checking first .git/refs/heads/branch. If this does not exists it falls back to the logs folder. And it stops here assuming that the hash is inside the cmake git files.

It is kind of peculiar to get into this situation, it is not at all common. It has to be a repository that was cleaned and purged + a completly clean build, no cmake files generated.

Unfortunately I do no see any workaorund calling git as a process. But considering this is an rare exception I think it is fine.

Cheers
Alina