summaryrefslogtreecommitdiff
path: root/src/rebar_git_resource.erl
diff options
context:
space:
mode:
authorPost hawk <mbarulin@gmail.com>2016-05-18 12:00:10 +0300
committerPost hawk <mbarulin@gmail.com>2016-05-18 12:00:10 +0300
commit8db9bc4e1d833603b3598515c18627f92d5b6e94 (patch)
tree5ce70f3fc433737ca27eadc55460e8d68d98f5ad /src/rebar_git_resource.erl
parent9f5a30f3d792bb2aa960d22eadb9219e28f992f2 (diff)
#1185 fix windows git working directory
fix issue #1185 git working directory issues due to command line options in Windows
Diffstat (limited to 'src/rebar_git_resource.erl')
-rw-r--r--src/rebar_git_resource.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl
index 5a6a5ef..ff43f76 100644
--- a/src/rebar_git_resource.erl
+++ b/src/rebar_git_resource.erl
@@ -18,9 +18,16 @@ lock(AppDir, {git, Url, _}) ->
lock(AppDir, {git, Url});
lock(AppDir, {git, Url}) ->
AbortMsg = io_lib:format("Locking of git dependency failed in ~s", [AppDir]),
+ Dir = rebar_utils:escape_double_quotes(AppDir),
{ok, VsnString} =
- rebar_utils:sh("git --git-dir=\"" ++ rebar_utils:escape_double_quotes(AppDir) ++ "/.git\" rev-parse --verify HEAD",
- [{use_stdout, false}, {debug_abort_on_error, AbortMsg}]),
+ case os:type() of
+ {win32, _} ->
+ rebar_utils:sh("git rev-parse --git-dir=\"" ++ Dir ++ "/.git\" --work-tree=\"" ++ Dir ++ "\" --verify HEAD",
+ [{use_stdout, false}, {debug_abort_on_error, AbortMsg}]);
+ _ ->
+ rebar_utils:sh("git --git-dir=\"" ++ Dir ++ "/.git\" rev-parse --verify HEAD",
+ [{use_stdout, false}, {debug_abort_on_error, AbortMsg}])
+ end,
Ref = string:strip(VsnString, both, $\n),
{git, Url, {ref, Ref}}.