Eyescale/CMake

GitHooks does not handle running in submodules

umlaeute opened this issue · 0 comments

I'm trying to use Servus in a project of mine.
Since it is not packaged for my distribution, i included Servus via a git submodule.
Servus in turn includes this repository (via git submodule, but I think that doesn't matter here).

Now trying to build the submoduled Servus fails happily with:

CMake Error: Could not open file for write in copy operation .../Servus/.git/hooks/pre-commit.tmp
CMake Error: : System Error: Not a directory
CMake Error at CMake/common/GitHooks.cmake:18 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMake/common/Common.cmake:152 (include)
  CMakeLists.txt:35 (include)

And yes, .../Servus/.git is not a directory, but a file (that contains a reference to the parent repository).
afaik, this is how git submodules work.

Since the GitHooks snippet already ignores the case where .git is missing altogether, it probably should do something sensible if it is not a directory as well...

This has also been reported in in Servus as HBPVIS/Servus#108