>From 5bdc13c989ec87b8fa3a7be8635aab998646c987 Mon Sep 17 00:00:00 2001
From: David Bremner <bremner@unb.ca>
Date: Fri, 20 Feb 2009 11:57:55 -0400
Subject: [PATCH] Add a variable magit-shell-executable, use that to run shell commands. This fixes a bug in magit-get-top-dir where it fails if the user's shell does not understand Bourne shell output redirection.

---
 magit.el |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/magit.el b/magit.el
index c31fb81..0e83e27 100644
--- a/magit.el
+++ b/magit.el
@@ -60,6 +60,11 @@
   :group 'magit
   :type 'string)
 
+(defcustom magit-shell-executable "/bin/sh"
+  "The name of the the shell to execute commands."
+  :group 'magit
+  :type 'string)
+
 (defcustom magit-save-some-buffers t
   "Non-nil means that \\[magit-status] will save modified buffers before running.
 Setting this to t will ask which buffers to save, setting it to 'dontask will
@@ -209,8 +214,12 @@ Many Magit faces inherit from this one by default."
 	  " "
 	  (magit-format-shell-command fmt args)))
 
+(defun magit-shell-command-to-string (command)
+  (let ((shell-file-name magit-shell-executable))
+    (shell-command-to-string command)))
+
 (defun magit-shell-lines (command)
-  (let ((str (shell-command-to-string command)))
+  (let ((str (magit-shell-command-to-string command)))
     (if (string= str "")
 	nil
       (let ((lines (nreverse (split-string str "\n"))))
@@ -219,7 +228,7 @@ Many Magit faces inherit from this one by default."
 	(nreverse lines)))))
 
 (defun magit-shell (command)
-  (let ((str (shell-command-to-string command)))
+  (let ((str (magit-shell-command-to-string command)))
     (if (string= str "")
 	nil
       (if (equal (elt str (- (length str) 1)) ?\n)
-- 
1.6.3.1

