From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH 2/2] Skip git-version determination if git command fails Date: Wed, 19 Aug 2009 16:06:18 -0400 Message-ID: <1250712378-16345-3-git-send-email-bernt@norang.ca> References: <87vdkju8lc.fsf@gollum.intra.norang.ca> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdrQv-0007CL-0w for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdrQq-00078J-EC for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:56 -0400 Received: from [199.232.76.173] (port=56769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdrQq-00077u-8Q for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:52 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:58327) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MdrQp-0005AV-6P for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:51 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MdrQl-000P4x-R7 for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 20:06:47 +0000 In-Reply-To: <87vdkju8lc.fsf@gollum.intra.norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bernt Hansen This removes errors generated on a windows system where msysGit is installed in git bash only and not available from cmd.exe in the user's PATH. --- lisp/org.el | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 63ce2de..2f3cfb1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -106,21 +106,22 @@ With prefix arg HERE, insert it at point." (git-version) (dir (concat (file-name-directory (locate-library "org")) "../" )) (version)) - (if (file-exists-p (expand-file-name ".git" dir)) + (if (and (file-exists-p (expand-file-name ".git" dir)) + (executable-find "git")) (let ((pwd (substring (pwd) 10))) (cd dir) - (shell-command "git describe --abbrev=4 HEAD") - (save-excursion - (set-buffer "*Shell Command Output*") - (goto-char (point-min)) - (re-search-forward "[^\n]+") - (setq git-version (match-string 0)) - (subst-char-in-string ?- ?. git-version t) - (shell-command "git diff-index --name-only HEAD --") - (unless (eql 1 (point-max)) - (setq git-version (concat git-version ".dirty"))) - (setq org-version (concat org-version " (" git-version ")"))) - (cd pwd))) + (if (eql 0 (shell-command "git describe --abbrev=4 HEAD")) + (save-excursion + (set-buffer "*Shell Command Output*") + (goto-char (point-min)) + (re-search-forward "[^\n]+") + (setq git-version (match-string 0)) + (subst-char-in-string ?- ?. git-version t) + (shell-command "git diff-index --name-only HEAD --") + (unless (eql 1 (point-max)) + (setq git-version (concat git-version ".dirty"))) + (setq org-version (concat org-version " (" git-version ")"))) + (cd pwd)))) (setq version (format "Org-mode version %s" org-version)) (if here (insert version)) (message version) -- 1.6.4