[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [PATCH 2/2] Skip git-version determination if git command fail
From: |
Bernt Hansen |
Subject: |
[Orgmode] [PATCH 2/2] Skip git-version determination if git command fails |
Date: |
Wed, 19 Aug 2009 16:06:18 -0400 |
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
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, (continued)
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Nick Dokos, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Nick Dokos, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- [Orgmode] [PATCH 1/2] Use lisp cd function to change directories to avoid shell dependencies, Bernt Hansen, 2009/08/19
- [Orgmode] [PATCH 2/2] Skip git-version determination if git command fails,
Bernt Hansen <=
- [Orgmode] [PATCH 0/2] org-version fix for windows, Bernt Hansen, 2009/08/19
- [Orgmode] Re: [PATCH 0/2] org-version fix for windows, Bernt Hansen, 2009/08/19
- [Orgmode] Re: [PATCH 0/2] org-version fix for windows, Bernt Hansen, 2009/08/20
- [Orgmode] Re: [PATCH 0/2] org-version fix for windows, Carsten Dominik, 2009/08/20
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Manish, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Bernt Hansen, 2009/08/19
- Re: [Orgmode] [PATCH 0/2] Teach org-version to include git version information, Nick Dokos, 2009/08/19