all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Glenn Morris <rgm@gnu.org>, emacs-devel@gnu.org
Subject: [PATCH] version.el (emacs-repository-get-version): Let git change the directory.
Date: Tue, 18 Nov 2014 01:41:45 +0100	[thread overview]
Message-ID: <1416271305-6656-1-git-send-email-mina86@mina86.com> (raw)

---
 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




             reply	other threads:[~2014-11-18  0:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18  0:41 Michal Nazarewicz [this message]
2014-11-18  1:52 ` [PATCH] version.el (emacs-repository-get-version): Let git change the directory Glenn Morris
2014-11-18 10:17 ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416271305-6656-1-git-send-email-mina86@mina86.com \
    --to=mina86@mina86.com \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.