From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies Date: Wed, 19 Aug 2009 16:06:17 -0400 Message-ID: <1250712378-16345-2-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 1MdrQu-0007CJ-Un 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-00078F-F7 for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:55 -0400 Received: from [199.232.76.173] (port=56770 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdrQq-00077w-71 for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 16:06:52 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:58302) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MdrQp-0005AL-6U 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 1MdrQk-000P4T-Pn for emacs-orgmode@gnu.org; Wed, 19 Aug 2009 20:06:46 +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 fixes git version determination on windows for cygwin and for msysGit where git is installed in the user's PATH for the windows command shell. --- lisp/org.el | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e2cdce8..63ce2de 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -104,25 +104,27 @@ With prefix arg HERE, insert it at point." (interactive "P") (let* ((org-version org-version) (git-version) - (dir (concat (file-name-directory (locate-library "org")) "../" ))) + (dir (concat (file-name-directory (locate-library "org")) "../" )) + (version)) (if (file-exists-p (expand-file-name ".git" dir)) - (progn - (shell-command (concat "cd " dir " && git describe --abbrev=4 HEAD")) - (save-excursion - (set-buffer "*Shell Command Output*") - (goto-char (point-min)) - (replace-regexp "-" ".") - (goto-char (point-min)) - (re-search-forward "[^\n]+") - (setq git-version (match-string 0)) - (shell-command (concat "cd " dir " && 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 ")"))))) - (let ((version (format "Org-mode version %s" org-version))) - (if here (insert version)) - (message version) - version))) + (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))) + (setq version (format "Org-mode version %s" org-version)) + (if here (insert version)) + (message version) + version)) ;;; Compatibility constants -- 1.6.4