summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Gorodnitzky <misaka@pobox.com>2010-11-16 01:25:14 +0000
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2010-11-20 23:32:49 +0100
commit064195dc5a90f5b0cc3ae92e8373671b0043033f (patch)
treebf7ed258af8440b5300cb69a91cdf90de20c20e2
parentb2e7e5b7874452cd93554b1da5fe4fc32cecf14c (diff)
Fix git tag and branch dependency handling
Change git downloads and updates to not create branches and fix git tag handling.
-rw-r--r--src/rebar_deps.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 74c425f..a7baae9 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -278,11 +278,11 @@ download_source(AppDir, {hg, Url, Rev}) ->
download_source(AppDir, {git, Url, {branch, Branch}}) ->
ok = filelib:ensure_dir(AppDir),
rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), [], filename:dirname(AppDir)),
- rebar_utils:sh(?FMT("git checkout ~s", [Branch]), [], AppDir);
+ rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [], AppDir);
download_source(AppDir, {git, Url, {tag, Tag}}) ->
ok = filelib:ensure_dir(AppDir),
rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(AppDir)]), [], filename:dirname(AppDir)),
- rebar_utils:sh(?FMT("git checkout -b ~s", [Tag]), [], AppDir);
+ rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [], AppDir);
download_source(AppDir, {git, Url, Rev}) ->
download_source(AppDir, {git, Url, {branch, Rev}});
download_source(AppDir, {bzr, Url, Rev}) ->
@@ -303,10 +303,12 @@ update_source(Dep) ->
Dep#dep.source),
Dep.
-update_source(AppDir, {git, _Url, {Type, Refspec}})
- when Type =:= branch orelse
- Type =:= tag ->
- rebar_utils:sh(?FMT("git pull origin ~s", [Refspec]), [], AppDir);
+update_source(AppDir, {git, _Url, {branch, Branch}}) ->
+ rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir),
+ rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), [], AppDir);
+update_source(AppDir, {git, _Url, {tag, Tag}}) ->
+ rebar_utils:sh(?FMT("git fetch --tags origin", []), [], AppDir),
+ rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), [], AppDir);
update_source(AppDir, {git, Url, Refspec}) ->
update_source(AppDir, {git, Url, {branch, Refspec}});
update_source(AppDir, {svn, _Url, Rev}) ->