emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] version.el (emacs-repository-get-version): Let git change the di


From: Michal Nazarewicz
Subject: [PATCH] version.el (emacs-repository-get-version): Let git change the directory.
Date: Tue, 18 Nov 2014 01:41:45 +0100

---
 lisp/ChangeLog  |  5 +++++
 lisp/version.el | 14 ++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0075c5a..e5baecc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-18  Michal Nazarewicz  <address@hidden>
+
+       * version.el (emacs-repository-get-version): Let git change the
+       directory.  This makes the code one line shorter. ;)
+
 2014-11-17  Michal Nazarewicz  <address@hidden>
 
        * textmodes/tildify.el (tildify-pattern, tildify-space-string):
diff --git a/lisp/version.el b/lisp/version.el
index cab2d28..db31308 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -184,14 +184,12 @@ only ask the VCS if we cannot find any information 
ourselves."
        ((file-directory-p (expand-file-name ".git" dir))
         (message "Waiting for git...")
         (with-temp-buffer
-          (let ((default-directory (file-name-as-directory dir)))
-            (and (eq 0
-                     (condition-case nil
-                         (call-process "git" nil '(t nil) nil "rev-parse"
-                                       "HEAD")
-                       (error nil)))
-                 (not (zerop (buffer-size)))
-                 (replace-regexp-in-string "\n" "" (buffer-string))))))))
+          (and (zerop (condition-case nil
+                          (call-process "git" nil '(t nil) nil
+                                        "-C" dir "rev-parse" "HEAD")
+                        (error nil)))
+               (not (zerop (buffer-size)))
+               (replace-regexp-in-string "\n" "" (buffer-string)))))))
 
 ;; We put version info into the executable in the form that `ident' uses.
 (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
-- 
2.1.0.rc2.206.gedb03e5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]