summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Ellis <benjaminster@gmail.com>2011-08-12 20:14:17 -0400
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2011-09-01 22:29:55 +0200
commit3ef7db59cbe819b53244f86d682b0065ccd9b82a (patch)
tree8787e44b4d854cea3309ac20b1d25be5eabf18af /src
parent8997fe8bcae8f68dbd69ee4dc0635048e3d859ec (diff)
Add support for checking out specific git commit
Diffstat (limited to 'src')
-rw-r--r--src/rebar_deps.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index ac6add8..c35d14e 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -354,7 +354,10 @@ download_source(AppDir, {git, Url, {tag, Tag}}) ->
[{cd, filename:dirname(AppDir)}]),
rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [{cd, AppDir}]);
download_source(AppDir, {git, Url, Rev}) ->
- download_source(AppDir, {git, Url, {branch, Rev}});
+ ok = filelib:ensure_dir(AppDir),
+ rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]),
+ [{cd, filename:dirname(AppDir)}]),
+ rebar_utils:sh(?FMT("git checkout -q ~s", [Rev]), [{cd, AppDir}]);
download_source(AppDir, {bzr, Url, Rev}) ->
ok = filelib:ensure_dir(AppDir),
rebar_utils:sh(?FMT("bzr branch -r ~s ~s ~s",
@@ -396,8 +399,10 @@ update_source(AppDir, {git, _Url, {tag, Tag}}) ->
ShOpts = [{cd, AppDir}],
rebar_utils:sh("git fetch --tags origin", ShOpts),
rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), ShOpts);
-update_source(AppDir, {git, Url, Refspec}) ->
- update_source(AppDir, {git, Url, {branch, Refspec}});
+update_source(AppDir, {git, _Url, Refspec}) ->
+ ShOpts = [{cd, AppDir}],
+ rebar_utils:sh("git fetch origin", ShOpts),
+ rebar_utils:sh(?FMT("git checkout -q ~s", [Refspec]), ShOpts);
update_source(AppDir, {svn, _Url, Rev}) ->
rebar_utils:sh(?FMT("svn up -r ~s", [Rev]), [{cd, AppDir}]);
update_source(AppDir, {hg, _Url, Rev}) ->