summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernt Hansen <bernt@norang.ca>2009-08-18 11:57:36 -0400
committerCarsten Dominik <carsten.dominik@gmail.com>2009-08-18 20:05:45 +0100
commita5e87a47230030ab4c4bc4521f5af47a7521243a (patch)
tree9fc2233266ff499f4f76b6997fc5909653290614
parent8c338128548fc00de808674f4f814594efc8188a (diff)
downloadorg-mode-a5e87a47230030ab4c4bc4521f5af47a7521243a.tar.gz
Add git version number to org-version information
Adds the output of 'git describe' to the org-version string if we are running from a git repository. This identifies exactly what commit is checked out in the org-mode git repository when reporting the org-mode version number. org-version returns something like: Org-mode version 6.29trans (release_6.29c.42.g5996) which shows 6.29trans (somewhere after the last release tag) which is 42 commits after release_6.29c at git commit 5996. The git describe information is not included if org mode is not running from a git repository.
-rw-r--r--lisp/org.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 80419d8..1f4055d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -102,10 +102,22 @@
"Show the org-mode version in the echo area.
With prefix arg HERE, insert it at point."
(interactive "P")
- (let ((version (format "Org-mode version %s" org-version)))
- (message version)
- (if here
- (insert version))))
+ (let* ((org-version org-version)
+ (dir (concat (file-name-directory (locate-library "org")) "../" )))
+ (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 org-version (concat org-version " (" (match-string 0) ")")))))
+ (let ((version (format "Org-mode version %s" org-version)))
+ (message version)
+ (if here
+ (insert version)))))
;;; Compatibility constants