diff options
Diffstat (limited to 'src/rebar_git_resource.erl')
-rw-r--r-- | src/rebar_git_resource.erl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 5a6a5ef..f0f5f03 100644 --- a/src/rebar_git_resource.erl +++ b/src/rebar_git_resource.erl @@ -17,10 +17,17 @@ lock(AppDir, {git, Url, _}) -> lock(AppDir, {git, Url}); lock(AppDir, {git, Url}) -> - AbortMsg = io_lib:format("Locking of git dependency failed in ~s", [AppDir]), + AbortMsg = lists:flatten(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}}. |