mesa: Fix generation of git_sha1.h.tmp for gitlinks
authorChad Versace <chad.versace@intel.com>
Fri, 10 Jul 2015 01:46:21 +0000 (18:46 -0700)
committerChad Versace <chad.versace@intel.com>
Fri, 10 Jul 2015 18:22:47 +0000 (11:22 -0700)
Don't assume that $(top_srcdir)/.git is a directory. It may be a
gitlink file [1] if $(top_srcdir) is a submodule checkout or a linked
worktree [2].

[1] A "gitlink" is a text file that specifies the real location of
    the gitdir.
[2] Linked worktrees are a new feature in Git 2.5.

Cc: "10.6, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/Makefile.am

index c86ded979b962727ed507cc5b26dbb4631ad7516..eb4a3da3c840993a9214f779dff145f24780e075 100644 (file)
@@ -38,8 +38,11 @@ gl_HEADERS = $(top_srcdir)/include/GL/*.h
 
 .PHONY: main/git_sha1.h.tmp
 main/git_sha1.h.tmp:
+       @# Don't assume that $(top_srcdir)/.git is a directory. It may be
+       @# a gitlink file if $(top_srcdir) is a submodule checkout or a linked
+       @# worktree.
        @touch main/git_sha1.h.tmp
-       @if test -d $(top_srcdir)/.git; then \
+       @if test -e $(top_srcdir)/.git; then \
                if which git > /dev/null; then \
                    git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
                        sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \