.git folder missing when building

Asked by MattKC on 2019-02-14

I'm using git-build-recipe to create a regular build for a repository that is automatically imported from GitHub. My project is Qt-based, and when building (in the configure/qmake stage) it queries Git for the current commit hash in order to hard-code it into the build. However this step doesn't work correctly and no Git hash is retrieved.

The buildlog has the following error:

fatal: not a git repository: '/<<PKGBUILDDIR>>/.git'

And indeed temporarily running `ls -a` during the build process shows that the .git folder is missing.

I assume this has been stripped out at some point intentionally, either in the import process or the build process, so is there any way I can set a flag not to do that?

Question information

English Edit question
Launchpad itself Edit question
No assignee Edit question
Solved by:
William Grant
Last query:
Last reply:

This question was reopened

Best William Grant (wgrant) said : #1

Debian source packages do not include full VCS history, as that bloats them massively and can have inconvenient copyright implications. You'll need to find some other way to get the git commit when building your binary packages, perhaps by parsing it out of the version in debian/changelog.

MattKC (itsmattkc) said : #2

Thank you, that does sound like a good alternative.