{"thread":{"id":"13173","subject":"Re: [PATCH] git.el: Set process-environment instead of invoking env (follow-up 1)","startedAt":"2008-04-18T13:07:12Z","lastAt":"2008-04-18T13:34:18Z","messageCount":2,"participants":["David Kågedal","Clifford Caoile"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"74733","messageId":"1f748ec60804180607v474ffc55ta7eeb62dd449344@mail.gmail.com","threadId":"13173","inReplyTo":null,"subject":"[PATCH] git.el: Set process-environment instead of invoking env (follow-up 1)","fromName":"Clifford Caoile","fromEmail":"piyo@users.sourceforge.net","sentAt":"2008-04-18T13:07:12Z","receivedAt":"2008-04-18T13:07:12Z","isPatch":true,"sender":{"key":"piyo@users.sourceforge.net","avatar":null},"body":"According to the similar patch from David Kågedal [1], \"this will make\nit a little less posix-dependent and more efficient.\" However, there\nare two other areas that need to replaced, namely\ngit-run-command-region and git-run-hooks. This patch implements the\nchanges of [1] onto those Emacs Lisp functions.\n\nIf unpatched, using the git port \"msysgit\" on Windows will require\ndefadvice changes as shown at [2] (also explained at 4msysgit.git\n[3]).\n\nI have tested git-run-command-region on msysgit, because this is\nalways called by git-commit (via git-commit-tree <- git-do-commit <-\ngit-commit-file). However, I could not test git-run-hooks because it\ncurrently does not work on the Emacs Windows port. The latter reports\nthe hooks files as a+rw and a-x, despite msysgit and cygwin chmod\nsetting on the respective files.\n\nReferences:\n[1] f27e55864317611385be4d33b3c53ca787379df9\n[2] http://groups.google.com/group/msysgit/browse_thread/thread/b852fef689817707\n[3] http://repo.or.cz/w/git/mingw/4msysgit.git?a=commit;h=3c30e5e87358eba7b6d7dcd6301ae8438f0c30ea\n\nSigned-off-by: Clifford Caoile <piyo@users.sourceforge.net>\n---\n contrib/emacs/git.el |   11 ++++-------\n 1 files changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/emacs/git.el b/contrib/emacs/git.el\nindex 4fa853f..2557a76 100644\n--- a/contrib/emacs/git.el\n+++ b/contrib/emacs/git.el\n@@ -232,10 +232,8 @@ and returns the process output as a string, or\nnil if the git failed.\"\n\n (defun git-run-command-region (buffer start end env &rest args)\n   \"Run a git command with specified buffer region as input.\"\n-  (unless (eq 0 (if env\n-                    (git-run-process-region\n-                     buffer start end \"env\"\n-                     (append (git-get-env-strings env) (list \"git\") args))\n+  (unless (eq 0 (let ((process-environment (append (git-get-env-strings env)\n+                                                   process-environment)))\n                   (git-run-process-region\n                    buffer start end \"git\" args)))\n     (error \"Failed to run \\\"git %s\\\":\\n%s\" (mapconcat (lambda (x) x)\nargs \" \") (buffer-string))))\n@@ -250,9 +248,8 @@ and returns the process output as a string, or nil\nif the git failed.\"\n             (erase-buffer)\n             (cd dir)\n             (setq status\n-                  (if env\n-                      (apply #'call-process \"env\" nil (list buffer t) nil\n-                             (append (git-get-env-strings env) (list\nhook-name) args))\n+                  (let ((process-environment (append (git-get-env-strings env)\n+                                                     process-environment)))\n                     (apply #'call-process hook-name nil (list buffer\nt) nil args))))\n           (display-message-or-buffer buffer)\n           (eq 0 status)))))\n-- \n1.5.5.1015.g9d258\n"},{"id":"74727","messageId":"87ej93l21x.fsf@lysator.liu.se","threadId":"13173","inReplyTo":"1f748ec60804180607v474ffc55ta7eeb62dd449344@mail.gmail.com","subject":"Re: [PATCH] git.el: Set process-environment instead of invoking env (follow-up 1)","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2008-04-18T13:34:18Z","receivedAt":"2008-04-18T13:34:18Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"\"Clifford Caoile\" <piyo@users.sourceforge.net> writes:\n\n> According to the similar patch from David Kågedal [1], \"this will make\n> it a little less posix-dependent and more efficient.\" However, there\n> are two other areas that need to replaced, namely\n> git-run-command-region and git-run-hooks. This patch implements the\n> changes of [1] onto those Emacs Lisp functions.\n\nOf course. Silly that I missed them.\n\n-- \nDavid Kågedal\n"}]}