Created
January 26, 2012 12:41
-
-
Save djpowell/1682601 to your computer and use it in GitHub Desktop.
Fix lein bootstrap for Windows msysGit users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 525365caf9635b2e0f2a06eb8993bb95febf1b20 Mon Sep 17 00:00:00 2001 | |
From: David Powell <[email protected]> | |
Date: Thu, 26 Jan 2012 12:29:53 +0000 | |
Subject: [PATCH] Fix shell to git for msysgit users on Windows | |
--- | |
src/leiningen/git_deps.clj | 8 +++++++- | |
1 files changed, 7 insertions(+), 1 deletions(-) | |
diff --git a/src/leiningen/git_deps.clj b/src/leiningen/git_deps.clj | |
index 762eed8..0c5b9a0 100644 | |
--- a/src/leiningen/git_deps.clj | |
+++ b/src/leiningen/git_deps.clj | |
@@ -28,11 +28,17 @@ | |
(string/split #"\.") | |
butlast))) | |
+;; msys git on windows is on the path as a git.cmd batch file, which | |
+;; must be run via the command shell | |
+(def ^{:private true} shell-prefix | |
+ (when (re-matches #".*Windows.*" (System/getProperty "os.name")) | |
+ [(System/getenv "ComSpec") "/C"])) | |
+ | |
(defn- exec | |
"Run a command, throwing an exception if it fails, returning the | |
result as with clojure.java.shell/sh." | |
[& args] | |
- (let [{:keys [exit out err] :as result} (apply sh/sh args)] | |
+ (let [{:keys [exit out err] :as result} (apply sh/sh (concat shell-prefix args))] | |
(if (zero? exit) | |
result | |
(throw | |
-- | |
1.7.4 |
Yeah, putting a copy of git.exe on the path, rather than the .cmd file works.
Interestingly though, if you have both git.exe and git.cmd on the path, the git.cmd file always gets used in preference, even if the exe comes earlier in the path.
Putting symlinks, created by mklink.exe, on the path rather than .cmd flies also works, but they are only available on Windows 7 and Vista.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anything we can do to make this more convenient? I could imagine that putting the git.exe directory into the PATH instead of git.cmd should work without any changes...