.git folder missing when building

Asked by MattKC

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

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
William Grant
Solved:
Last query:
Last reply:
Revision history for this message
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.

Revision history for this message
MattKC (itsmattkc) said :
#2

Thank you, that does sound like a good alternative.