When configuring kicad, I see the following messages: -- Found Git: /usr/bin/git (found version "2.44.2") -- Using Git to determine build version string. -- git describe returned error 128: fatal: not a git repository (or any parent up to mount point /var) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). -- git rev-parse returned error 128: fatal: not a git repository (or any parent up to mount point /var) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). -- git rev-list --count returned error 128: fatal: not a git repository (or any parent up to mount point /var) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). These checks are performed in a few places in the cmake files, and defined in cmake/CreateGitVersionHeader.cmake. While kicad does fall back to an internally specified version number (cmake/KiCadVersion.cmake), having this behavior in there can cause the version to be reported wrong in the compiled package. I think the best way to deal with this is appending a no-op macro to the CreateGitVersionHeader.cmake file.
I'm wondering how realistic this scenario is. For this to happen you'd need the following to happen: - have a valid .git directory somewhere on the path of /var/tmp/portage (or whavever $PORTAGE_TMPDIR/tmp is if user set that) - .git directory has to be owned by `portage` user - or in the `portage` user's home directory have a .gitconfig file that declares said .git directory on the path to be safe Otherwise this check will always fail and we will never pick up a random git commit hash. FWIW I've tested this locally to be the case. I just don't see this happening on a user system in general. However if someone is emerging kicad-9999 we want this feature, since that is coming from a git repository. While it does print some warning messages during configure time, I don't think this is worth investing time into.
The most likely scenario in my opinion is a dotfile management scheme that makes $HOME a git repository (I've seen various people do this), and installing Gentoo Prefix in $HOME (which is also the default). Anyway I think it's good to try to minimize the possibility for miscompilation due to effects in the environment, for the same reason we avoid automagic deps.