unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] version.el (emacs-repository-get-version): Let git change the directory.
@ 2014-11-18  0:41 Michal Nazarewicz
  2014-11-18  1:52 ` Glenn Morris
  2014-11-18 10:17 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2014-11-18  0:41 UTC (permalink / raw)
  To: Glenn Morris, emacs-devel

---
 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  <mina86@mina86.com>
+
+	* version.el (emacs-repository-get-version): Let git change the
+	directory.  This makes the code one line shorter. ;)
+
 2014-11-17  Michal Nazarewicz  <mina86@mina86.com>
 
 	* 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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] version.el (emacs-repository-get-version): Let git change the directory.
  2014-11-18  0:41 [PATCH] version.el (emacs-repository-get-version): Let git change the directory Michal Nazarewicz
@ 2014-11-18  1:52 ` Glenn Morris
  2014-11-18 10:17 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2014-11-18  1:52 UTC (permalink / raw)
  To: Michal Nazarewicz; +Cc: emacs-devel


git -C /tmp rev-parse
-> Unknown option: -C

git --version
-> git version 1.7.1

lsb_release -d
-> Red Hat Enterprise Linux Server release 6.6



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] version.el (emacs-repository-get-version): Let git change the directory.
  2014-11-18  0:41 [PATCH] version.el (emacs-repository-get-version): Let git change the directory Michal Nazarewicz
  2014-11-18  1:52 ` Glenn Morris
@ 2014-11-18 10:17 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2014-11-18 10:17 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

() Michal Nazarewicz <mina86@mina86.com>
() Tue, 18 Nov 2014 01:41:45 +0100

   -	     (and (eq 0
   +	   (and (zerop (condition-case nil

Two problems: (a) This change introduces the possibility of
evaling ‘(zerop nil)’, which throws ‘wrong-type-argument’;
(b) the ChangeLog entry does not mention the change.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-18 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18  0:41 [PATCH] version.el (emacs-repository-get-version): Let git change the directory Michal Nazarewicz
2014-11-18  1:52 ` Glenn Morris
2014-11-18 10:17 ` Thien-Thi Nguyen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).