summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2011-07-17 16:54:47 +0200
committerAchim Gratz <Stromeko@Stromeko.DE>2012-04-20 21:04:08 +0200
commitf29ef857ae7a3ad4d191a3c167f9c96d8faf61bd (patch)
tree3c55febf355c274f75bca34de048c009b143ab51
parenta5cb04dcd8183a573ac7c60726a5b6993840e051 (diff)
downloadorg-mode-f29ef857ae7a3ad4d191a3c167f9c96d8faf61bd.tar.gz
inject git-describe version into org.el during install
* lisp/org.el (org-git-version): placeholder for recording the Git version of org during install * lisp/org.el (org-version): initialize local git-version with placeholder and fall through using it when org is not installed in a Git repository
-rw-r--r--lisp/Makefile7
-rw-r--r--lisp/org.el11
2 files changed, 14 insertions, 4 deletions
diff --git a/lisp/Makefile b/lisp/Makefile
index b14d6f1..963d08c 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -2,6 +2,11 @@ ifeq ($(MAKELEVEL), 0)
$(error This make needs to be started as a sub-make from the toplevel directory.)
endif
+GITVERSION = $(shell git describe --abbrev=6 HEAD)
+ifneq ($(shell git status -uno --porcelain), '')
+ GITVERSION := $(GITVERSION).dirty
+endif
+
LISPO = org-install.el
LISPF = $(subst $(LISPO),,$(wildcard *.el))
LISPC = $(LISPF:%el=%elc)
@@ -26,6 +31,8 @@ org-install.el: $(LISPC)
install: $(LISPF) compile autoloads
if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
$(CP) $(LISPC) $(LISPF) $(LISPO) $(lispdir)
+ perl -i -pe 's/^(\(defconst org-git-version ).*/\1 "$(GITVERSION)"/;' $(lispdir)/org.el
+ $(MAKE) $(lispdir)/org.elc
clean:
$(RM) $(LISPC)
diff --git a/lisp/org.el b/lisp/org.el
index b2b140c..c761038 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -212,6 +212,10 @@ identifier."
(defconst org-version "7.8.09"
"The version number of the file org.el.")
+(defconst org-git-version "N/A"
+ "The Git version of org-mode. Inserted by installing org-mode
+ or when a release is made.")
+
;;;###autoload
(defun org-version (&optional here)
"Show the org-mode version in the echo area.
@@ -219,7 +223,7 @@ With prefix arg HERE, insert it at point."
(interactive "P")
(let* ((origin default-directory)
(version org-version)
- (git-version)
+ (git-version org-git-version)
(dir (concat (file-name-directory (locate-library "org")) "../" )))
(when (and (file-exists-p (expand-file-name ".git" dir))
(executable-find "git"))
@@ -232,12 +236,11 @@ With prefix arg HERE, insert it at point."
(setq git-version (buffer-substring (point) (point-at-eol))))
(subst-char-in-string ?- ?. git-version t)
(when (string-match "\\S-"
- (shell-command-to-string
- "git diff-index --name-only HEAD --"))
+ (shell-command-to-string "git status -uno --porcelain"))
(setq git-version (concat git-version ".dirty")))
(setq version (concat version " (" git-version ")"))))
(cd origin)))
- (setq version (format "Org-mode version %s" version))
+ (setq version (format "Org-mode version %s (%s)" version git-version))
(if here (insert version))
(message version)))