git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Clifford Caoile" <piyo@users.sourceforge.net>
To: "Git Mailing List" <git@vger.kernel.org>,
	"David Kågedal" <davidk@lysator.liu.se>,
	"Git Maintainer" <gitster@pobox.com>
Subject: [PATCH] git.el: Set process-environment instead of invoking env (follow-up 1)
Date: Fri, 18 Apr 2008 22:07:12 +0900	[thread overview]
Message-ID: <1f748ec60804180607v474ffc55ta7eeb62dd449344@mail.gmail.com> (raw)

According to the similar patch from David Kågedal [1], "this will make
it a little less posix-dependent and more efficient." However, there
are two other areas that need to replaced, namely
git-run-command-region and git-run-hooks. This patch implements the
changes of [1] onto those Emacs Lisp functions.

If unpatched, using the git port "msysgit" on Windows will require
defadvice changes as shown at [2] (also explained at 4msysgit.git
[3]).

I have tested git-run-command-region on msysgit, because this is
always called by git-commit (via git-commit-tree <- git-do-commit <-
git-commit-file). However, I could not test git-run-hooks because it
currently does not work on the Emacs Windows port. The latter reports
the hooks files as a+rw and a-x, despite msysgit and cygwin chmod
setting on the respective files.

References:
[1] f27e55864317611385be4d33b3c53ca787379df9
[2] http://groups.google.com/group/msysgit/browse_thread/thread/b852fef689817707
[3] http://repo.or.cz/w/git/mingw/4msysgit.git?a=commit;h=3c30e5e87358eba7b6d7dcd6301ae8438f0c30ea

Signed-off-by: Clifford Caoile <piyo@users.sourceforge.net>
---
 contrib/emacs/git.el |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 4fa853f..2557a76 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -232,10 +232,8 @@ and returns the process output as a string, or
nil if the git failed."

 (defun git-run-command-region (buffer start end env &rest args)
   "Run a git command with specified buffer region as input."
-  (unless (eq 0 (if env
-                    (git-run-process-region
-                     buffer start end "env"
-                     (append (git-get-env-strings env) (list "git") args))
+  (unless (eq 0 (let ((process-environment (append (git-get-env-strings env)
+                                                   process-environment)))
                   (git-run-process-region
                    buffer start end "git" args)))
     (error "Failed to run \"git %s\":\n%s" (mapconcat (lambda (x) x)
args " ") (buffer-string))))
@@ -250,9 +248,8 @@ and returns the process output as a string, or nil
if the git failed."
             (erase-buffer)
             (cd dir)
             (setq status
-                  (if env
-                      (apply #'call-process "env" nil (list buffer t) nil
-                             (append (git-get-env-strings env) (list
hook-name) args))
+                  (let ((process-environment (append (git-get-env-strings env)
+                                                     process-environment)))
                     (apply #'call-process hook-name nil (list buffer
t) nil args))))
           (display-message-or-buffer buffer)
           (eq 0 status)))))
-- 
1.5.5.1015.g9d258

             reply	other threads:[~2008-04-18 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 13:07 Clifford Caoile [this message]
2008-04-18 13:34 ` [PATCH] git.el: Set process-environment instead of invoking env (follow-up 1) David Kågedal

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1f748ec60804180607v474ffc55ta7eeb62dd449344@mail.gmail.com \
    --to=piyo@users.sourceforge.net \
    --cc=davidk@lysator.liu.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 public inbox

	https://80x24.org/mirrors/git.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).