--- /dev/null
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 3582B431FC2\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 12:35:40 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 8Q193bFxweqs for <notmuch@notmuchmail.org>;\r
+ Tue, 6 May 2014 12:35:35 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 5C104431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 12:35:35 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id DFDFA1000F2; Tue, 6 May 2014 22:35:30 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] build: check .git directory existence in srcdir (for\r
+ out-of-tree builds)\r
+Date: Tue, 6 May 2014 22:35:28 +0300\r
+Message-Id: <1399404928-15471-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 06 May 2014 19:35:40 -0000\r
+\r
+So that $(VERSION) and version.stamp uses the git-describe -based\r
+version data instead of the content of `version' file.\r
+\r
+For consistency also the git commands in Makefile[.local] target\r
+`verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ...\r
+commands (inside ifeq($(IS_GIT),yes)). Attempting to make this\r
+target outside of the tree will fail in any case.\r
+---\r
+ Makefile.local | 10 +++++-----\r
+ 1 file changed, 5 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/Makefile.local b/Makefile.local\r
+index f0c4453574b8..a9a6df8bf0e0 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -10,10 +10,10 @@\r
+ # repository), we let git append identification of the actual commit.\r
+ PACKAGE=notmuch\r
+ \r
+-IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)\r
++IS_GIT=$(shell if [ -d ${srcdir}/.git ] ; then echo yes ; else echo no; fi)\r
+ \r
+ ifeq ($(IS_GIT),yes)\r
+-DATE:=$(shell git log --date=short -1 --pretty=format:%cd)\r
++DATE:=$(shell git --git-dir=${srcdir}/.git log --date=short -1 --pretty=format:%cd)\r
+ else\r
+ DATE:=$(shell date +%F)\r
+ endif\r
+@@ -21,7 +21,7 @@ endif\r
+ VERSION:=$(shell cat ${srcdir}/version)\r
+ ifeq ($(filter release release-message pre-release update-versions,$(MAKECMDGOALS)),)\r
+ ifeq ($(IS_GIT),yes)\r
+-VERSION:=$(shell git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)\r
++VERSION:=$(shell git --git-dir=${srcdir}/.git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)\r
+ # Write the file 'version.stamp' in case its contents differ from $(VERSION)\r
+ FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; echo $$vs)\r
+ ifneq ($(FILE_VERSION),$(VERSION))\r
+@@ -200,11 +200,11 @@ verify-source-tree-and-version: verify-no-dirty-code\r
+ verify-no-dirty-code: release-checks\r
+ ifeq ($(IS_GIT),yes)\r
+ @printf "Checking that source tree is clean..."\r
+-ifneq ($(shell git ls-files -m),)\r
++ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),)\r
+ @echo "No"\r
+ @echo "The following files have been modified since the most recent git commit:"\r
+ @echo ""\r
+- @git ls-files -m\r
++ @git --git-dir=${srcdir}/.git ls-files -m\r
+ @echo ""\r
+ @echo "The release will be made from the committed state, but perhaps you meant"\r
+ @echo "to commit this code first? Please clean this up to make it more clear."\r
+-- \r
+1.8.0\r
+\r