mesa: Fix generation of git_sha1.h.tmp for gitlinks
mesa: Fix generation of git_sha1.h.tmp for gitlinks

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" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <a847aabaac44184372f6b1cd1a59aa254daaeb0b@igalia.com>
(cherry picked from commit 75784243df1f5bb0652fb243b37d69f36d493a86)

metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler