Use git rev-parse --symbolic-full-name to get the HEAD target ref

This will prevent us trying to depend on a file that doesn't exist in
case someone goes on a detached HEAD. For example, this could happen
during a bisect.

  (detached head) $ git rev-parse --symbolic-full-name HEAD
  HEAD
  (master) $ git rev-parse --symbolic-full-name HEAD
  refs/heads/master

This will break on a packed ref, though.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-10-15 20:19:06 -07:00 committed by Dirk Hohndel
parent f96299ea94
commit b3db9bb48a

View file

@ -8,7 +8,7 @@ exists(.git/HEAD): {
VERSION_SCRIPT = $$PWD/scripts/get-version VERSION_SCRIPT = $$PWD/scripts/get-version
# always use linux here -------------------vvv so we get the true full version # always use linux here -------------------vvv so we get the true full version
FULL_VERSION = "`$$VERSION_SCRIPT linux`" FULL_VERSION = "`$$VERSION_SCRIPT linux`"
version_h.depends = $$VERSION_SCRIPT $$system(sed \'s/ref: \\(.*\\)/.git\\/\\1/\' $$GIT_HEAD) version_h.depends = $$VERSION_SCRIPT $$PWD/.git/$$system("git rev-parse --symbolic-full-name HEAD")
version_h.commands = echo \\$${LITERAL_HASH}define VERSION_STRING \\\"`$$VERSION_SCRIPT $$VER_OS`\\\" > ${QMAKE_FILE_OUT} version_h.commands = echo \\$${LITERAL_HASH}define VERSION_STRING \\\"`$$VERSION_SCRIPT $$VER_OS`\\\" > ${QMAKE_FILE_OUT}
version_h.input = GIT_HEAD version_h.input = GIT_HEAD
version_h.output = $$VERSION_FILE version_h.output = $$VERSION_FILE